Here is my problem:
The car is going and it is leaving a pixel behind. Each pixel appears in the middle of the car (central Image point). And if the car hits the pixel (the wall), it explodes.
I think the concept is clear. But... the car will explode at the start of layout, because it creates a pixel just at its position.
So... how to do it elegantly, so the pixel has Collision ON, but after it does not overlaps the car anymore?
I tried with counters, like "Afters a car moves 30 pixels away from pixel, eneble pixel collision" for each pixel. But this solution is very heavy, especially after many hundrets of pixels appear.
Any "elegant" solution?
You could probably do it using the the canvas behavior and PixelAt, I'll see if I can make you an example
Easy! Have an image point behind the car, spawn the pixel at the image point, so it doesn't cause collition problems
Develop games in your browser. Powerful, performant & highly capable.
Do you need them to be "pixels"? For a change you could use a Tiled Background. Every time you turn 90 degrees spawn new TB, and when you going straight you change it's width or height.
Then set collisions between bike and all walls that already exist in the world - except the one you spawn and stretching while driving. That will make sure you can hit self wall only after turning 90 or more degrees at any direction and never the one you are spawning behind you.
Aher0: image point will not work because after turning 90 degree, the pixel will not be drawned at the cara path anymore. it will appear "after the car". the pixel will turn 90 with car at the same time. i hope i explained it clearly.
shinkan: what about the situation when someone turns 90 very quickly twice and the car basically turns
180? and also cars sprite and pixel (it is actually a sprite - square of width/height as car's width) after turning they touches eachother with the its corners. So the pixel/wall should appear about few pixels after the car...
Fortunately you are a human, and there is a plenty of time between turns for game to detect collisions.