Get help using Construct 2

Post » Mon Feb 27, 2012 12:44 pm

Hello, I am making a game with similar basics at the Physics - rolling platformer example.

I quickly came to the conclution that mixing the preprogrammed platform behaviour with the physics behaviour is a fail thing to do...So now im doing it with only physics...

I think the Physics - rolling platformer example lack one important thing.
A check for midair, so you cant jump while in the air.

Does anyone have a good idea how to add such a check to the example?
Cant seem to figure it out on my own...
Posts: 2
Reputation: 381

Post » Mon Feb 27, 2012 2:45 pm

Make a marker and have it set position to the the players object every tick...
(you can make it invisible later)

Resize it so that it sticks out a several pixels underneath the player object.. so it will overlap any floor that the player is standing on.

Create an instance variable in the player object, call it something like "IsOnFloor"

Now create an event with three conditions:

On player collision with ground
if marker is overlapping ground
if "IsOnFloor" = 0
------------> then set "IsOnFloor" to be 1

and then another event:
if marker is not overlapping ground
if "IsOnFloor" = 1
-------------->then set "IsOnFloor" to be 0

So you've probably already guessed the rest.. you have the "IsOnFloor" variable working, just make the player only able to jump if "IsOnFloor" = 1

hope that helps
Posts: 469
Reputation: 4,683

Post » Thu Mar 01, 2012 10:31 am

Thanks alot for the help, it works :D.
Posts: 2
Reputation: 381

Return to How do I....?

Who is online

Users browsing this forum: A01214706 and 12 guests