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

2020/7/20

Danpost plz help me out

Roshan123 Roshan123

2020/7/20

#
Sorry but I am not able to clearly express my problem Plz try to understand Danpost Plz play this Scenario atleast 2 times And note the speed of the car at ur 1st try and ur 2nd try Anything is not saved except the speed of the car in the counter when i click reset button(2nd try)
Roshan123 Roshan123

2020/7/20

#
I want the speed of the car not to be saved when i click reset button
danpost danpost

2020/7/20

#
Roshan123 wrote...
I want the speed of the car not to be saved when i click reset button
Need access to code.
Roshan123 Roshan123

2020/7/21

#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//Car. Class
//globally
Static Int s;
Int count;
Int time=1980;
Public void act()
{
     If(--time<1860)
    {    move(s) ;
          If(++count%350=0)
          {
               s++;
          }
     }
}
Roshan123 Roshan123

2020/7/21

#
1
2
3
4
5
6
7
//counter.class
//globally
Car car;
Public void act()
{
    setImage("Speed of the Car:"+car.s+"km/h", 35,Color.BLACK,new Color(0,0,0,0));
}
danpost danpost

2020/7/21

#
Remove 'static' from line 3.
You need to login to post a reply.