Skip to content
Advertisement

Image following line, or how to remove an image without refilling the screen

So, I’m trying my hand at remaking TRON, the snake like cycle arcade game. I am having an issue with my lighcycle images. So in TRON after the line is drawn it stays there, so when trying to place an image that needs to move in front of it, the image gets dragged along because i cant refill the screen otherwise the line made disappears.

My solution for this was to make the line almost as thick as the cycle so the line would cover the cycle image.

My issue is with the turning, it turns but then a cycle image gets left behind, and i tried delaying the bike waiting for the line to cover then turn, but then that would make the bike completely disappear and appear after turning. i was wondering if anyone could help me turn my cycle along with my line smoothly

here is my code

JavaScript

Advertisement

Answer

Here is a simple example of how that might work:

JavaScript

Obviously some modifications should be done for example not appending to the list while no keys are pressed (otherwise standing in one place will add a bunch of coords) or for example figuring out the coords of corners so that the rest can be deleted and only the corners left and probably other things too but this is the idea

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement