Accelerated Movement Issue

Get help using Construct 2

Post » Thu Dec 10, 2015 9:49 pm

Image

Hello! This is the first time I've ever used this program, but I have had experience with other visual tools (the Fusion series, Game Maker, etc) which have helped in my understanding of many of the concepts used in Construct.

What you see above is an attempt at creating a purely event-based movement engine with acceleration. The issue with it is that if you fiddle with the buttons while colliding with a wall, the moving object clips through a wall and moves to the other side. This only seems to happen when the player is holding right and pressing left at the same time. I have not had this happen with the left side.

I assume it has something to do with how I'm adding the acceleration, but I'm not sure. Help would be great!
B
22
S
11
G
6
Posts: 27
Reputation: 4,991

Post » Thu Dec 10, 2015 10:57 pm

It probably has to do with using the XDir boolean. How about instead just check if Xacc is greater than or less than zero in your overlap events?
B
89
S
30
G
94
Posts: 5,153
Reputation: 62,942

Post » Thu Dec 10, 2015 11:37 pm

Image
After setting this up, Image this oddity occurs.

(I apologize for the weird visuals, I just grab random images from my hard drive as placeholders.)
B
22
S
11
G
6
Posts: 27
Reputation: 4,991

Post » Fri Dec 11, 2015 3:13 am

I only looked quickly before. If the object is overlapping a wall then both your overlap events will run since you're not moving the object out of the wall. Consider if the object has a speed of 1 and hits a wall. The first overlap event sets the speed to -3, and the next event will set it back to 1. You don't get the same effect if the object moves to the left since only the second event runs.

You could possibly solve it with sub events so only one or the other is run, not both. I used "speed" instead of "xacc".

Sprite: is overlapping wall
--- speed<0
--- > add 4 to speed
--- else
--- speed>0
--- > subtract 4 from speed
B
89
S
30
G
94
Posts: 5,153
Reputation: 62,942


Return to How do I....?

Who is online

Users browsing this forum: Jhorbam and 10 guests