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

2013/3/4

Multiply by 2

SunnyD212 SunnyD212

2013/3/4

#
I'm trying to add to my game an object that will take my Player's current score and multiply it by two. The problem is that I don't know how to go about this. The object is randomly spawned and the Player's score is different every time, so I can't simply type Player.score++ . If anyone can help, I would be greatful!
danpost danpost

2013/3/4

#
What about:
Player.score = Player.score + Player.score;
// or
Player.score = Player.score * 2;
// or
Player.score += Player.score;
// or
Player.score *= 2;
You need to login to post a reply.