Fairly New
Could you tell me please how to call up an interger that has just been changed. this.randomRight(); moves an object a between 1 and 5 places to the right and this.getPosition will display the current position but not sure how to get how many places the object has moved
public void Findthesquare()
{
this.randomRight();
OUDialog.alert("I have now moved to stone"+this.getPosition());
}
[422 byte] By [
Mark_GRAa] at [2007-10-2 21:36:30]

> Could you tell me please how to call up an interger
> that has just been changed. this.randomRight(); moves
> an object a between 1 and 5 places to the right and
> this.getPosition will display the current position
> but not sure how to get how many places the object
> has moved
>
> public void Findthesquare()
> {
>this.randomRight();
> OUDialog.alert("I have now moved to
> stone"+this.getPosition());
>
> }
I've no idea what code you're working with here, but as I see it (being mostly blind and having to guess due to lack of information) you can either call getPosition before you move and then compare to getPostion after and see how many squares were moved, or you could modify the randomRight method to return the number of squares moved.
Good Luck
Lee
Hi Sorry The Question i have is to find what square a object has landed on
Description of game
1 the position of the receiver, an instance of RandomFrog is initially set a random integer between 1 and 5 inclusive. position is told via an alert box
2 The receiver is then sent a randomRight() message which moves it between 1 and 5 squares to the right. How many squares the object has moved is informed via an alert dialogue box
3 The user is then invited to guess what what the new position is via a request dialogue box initial answer of 1 is provided
4 Finally the user is informed via an alert box whether their guess is to small, big or exactly right
Code so far
public void FindtheFrog()
{
this.randomRight();
OUDialog.alert("I have now moved to square"+this.getPosition());
OUDialog.request("What is my new Position");
return(this.getBalance() + this.getCreditLimit());
}
}
> You've a method that returns nothing, but yet you
> return - um - balance plus credit limit? While
> finding a frog?
It's the future of online banking. No more of those boring rectangular interfaces. Everything has to look like a video game now, so if you want to pay off your credit card balance you first have to click on a falling frog. Then it explodes and you have 3 seconds to key in your payment amount, otherwise it's eaten by a dragon.