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

2014/5/24

Collisions

jennifer56 jennifer56

2014/5/24

#
Hi, I have a scenario where once I have collided with an object it resets it to a different position. I would like to refine this so it needs to be hit a certain amount of times before it is relocated
danpost danpost

2014/5/24

#
Just add an instance field to track the number of hits taken. When it reaches that certain value, then relocate. Steps: * add instance int field 'private int hitsTaken;' * when hit - add one to 'hitsTaken - check hitsTaken for value to relocate ? if at value - reset 'hitsTaken' to zero - relocate
You need to login to post a reply.