'Asteroids' style movement with walls?

Get help using Construct 2

Post » Wed Jan 22, 2014 7:49 pm

After fiddling with it a bit I don't find the custom behavior's push actions useful at all so I tried a few other methods. One that came to mind is to use the 8direction behavior instead and use events to set the horizontal and vertical velocities. It didn't work ideally since the 8direction often stops short of the walls if going too fast.

If you're fine using boxes with no rotation for the walls for now here is a capx. It uses a simplified case of the Separating Axis Theorem to do the push out and wall sliding. I was using it in another capx and found it to be a very clean way to do the wall sliding. I'll try to extend it into a plugin one of these days if I get time.
Posts: 5,553
Reputation: 85,319

Post » Thu Jan 23, 2014 3:26 am

[QUOTE=newt] Its not much different than raycasting.[/QUOTE]

One thing I have noticed (and not needed that long) about this forum is that people seem to assume that the game developing system can do all the *thinking* for them.

Programs and toolkits like Construct, Unity etc. help carrying a lot of the burden and eliminate the lots of tedious ground work needed compared to coding the same game with C(++) or Javascript. But they aren't (at least yet) totally automated systems that can solve *everything* one may need during game making.

So, there are still some human game making skills needed, like logic and trigonometry. And this one definitely need the trig (and some example drawings) to be solved.

Need help? Upload .capx file with your question.
Posts: 233
Reputation: 2,560

Post » Fri Jan 24, 2014 12:19 am

Thanks @Newt for your raycasting suggestion, that's a good idea.

I seem to have found a pretty good solution. Here's the capx for anyone interested.

Basically, I cast two parallel rays, then use some simple trig to determine the angle of the wall. Once i know the angle of the wall, I just use 'push out solid at angle' in the opposite direction to the wall.

It has problems with sharp inwards corners, but those can easily be fixed with some invisible collision if need be.
Posts: 3,191
Reputation: 32,739


Return to How do I....?

Who is online

Users browsing this forum: RevampedSpider and 5 guests