This site requires JavaScript, please enable it in your browser!
Greenfoot back
vagisha
vagisha wrote ...

2012/12/10

variable not changing..is something wrong in the code. the value of variable random is not changing even after envoking the function.?

1
2
vagisha vagisha

2012/12/11

#
so what i should do is to create a reference in the world and then call it?
danpost danpost

2012/12/11

#
vagisha wrote...
public class four extends numbers
{ public int ran=new equation().i;
    /**
     * Act - do whatever the four wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act() 
    {
        if(ran==0)
      { if(numbersee(you.class))
       turn(-2);
    }// Add your action code here.
    }    
Line 2 creates a new equation object which has not had a chance to 'act' before you get the value of 'i' from it. You need to get the value of 'i' from the equation object that already exists.
vagisha vagisha

2012/12/11

#
thanks everybody! i have got it right..
You need to login to post a reply.
1
2