How do I create TRON-like wall with proper collision...

Get help using Construct 2

Post » Sat Sep 17, 2016 8:18 am

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?

Thanks :)
B
3
Posts: 9
Reputation: 193

Post » Sat Sep 17, 2016 2:16 pm

You could probably do it using the the canvas behavior and PixelAt, I'll see if I can make you an example
B
42
S
17
G
17
Posts: 2,247
Reputation: 17,481

Post » Sat Sep 17, 2016 5:24 pm

Easy! Have an image point behind the car, spawn the pixel at the image point, so it doesn't cause collition problems
B
9
S
3
Posts: 113
Reputation: 1,009

Post » Sat Sep 17, 2016 8:32 pm

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.
ImageImageImageImage
B
158
S
67
G
43
Posts: 2,603
Reputation: 36,003

Post » Sun Sep 18, 2016 12:06 pm

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...
B
3
Posts: 9
Reputation: 193

Post » Sun Sep 18, 2016 2:25 pm

Fortunately you are a human, and there is a plenty of time between turns for game to detect collisions.
ImageImageImageImage
B
158
S
67
G
43
Posts: 2,603
Reputation: 36,003


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 27 guests