Re: Tanks - terrain question
Very basic.
Press the mouse and six green globs of dirt appear. If they appear in the same place as a previous glob, it will pile up.
Making holes with bullets is exactly the same, except you subtract the globs(makePile). you can just give a negative value to make pile.
Height[] holds the values made by the piles. You can use these values to drive across the terrain. You dont need gravity. I didnt put tanks in because you already know how to move across the screen. just use
Bullets collide with the ground in the exact same way as player drives on it. compare bullet.y against Height[bullet.x] for collisions. Then use makePile with a negative size.
I also didnt smooth the terrain. You can improve that.
Am I forgetting anything? Ah yes. Dont forget to clear the screen or the piles will not shrink.
Press the mouse and six green globs of dirt appear. If they appear in the same place as a previous glob, it will pile up.
Making holes with bullets is exactly the same, except you subtract the globs(makePile). you can just give a negative value to make pile.
Height[] holds the values made by the piles. You can use these values to drive across the terrain. You dont need gravity. I didnt put tanks in because you already know how to move across the screen. just use
- Code: Select all
player.y=Height[player.x]
Bullets collide with the ground in the exact same way as player drives on it. compare bullet.y against Height[bullet.x] for collisions. Then use makePile with a negative size.
I also didnt smooth the terrain. You can improve that.
Am I forgetting anything? Ah yes. Dont forget to clear the screen or the piles will not shrink.