So me and my friend are both VERY new to greenfoot and have given a project in school to create anything we want and will be awarded marks for creativity and complexity and have decided to create a game that resembles the 'tron' light cycle game. In which, two cars will drive around the world and leave a trail of their color behind them. If you touch the edge of the world or the other players color or the other player themselves then your car is removed from the world and the other player would win.
But we are instantly faced with two issues. 1. Every time the two cars touch, the yellow car ALWAYS wins (we think this is because it's first in the actors list. Secondly we have no idea how to get a trail to follow the cars. Any help with this would be great.
Code for the collision and removal:
Code
1 2 3 4 5 6 7 8 | Actor carBlue; carBlue = getOneObjectAtOffset( 0 , 0 , carBlue. class ); if (carBlue != null ) { World world; world = getWorld(); world.removeObject(carBlue); } |