Hard Request - N movement style

For questions about using Classic.

Post » Mon Dec 08, 2008 10:48 pm

This is how I handle instances where the player needs to be pushed out of the ground:

+While player overlaps ground
-Set player Y to player.Y - 1

The "While" loop will run until the conditions are no longer met, and it will happen instantaneously so you won't see it slowly pushed out of the ground.
Posts: 1,583
Reputation: 17,315

Post » Mon Dec 08, 2008 11:01 pm

My game freezes and when I close a error message come up about while having millions of iterations.
Posts: 164
Reputation: 2,178

Post » Mon Dec 08, 2008 11:25 pm

Pretty much all my movements are custom movements.
Whenever I'm doing gravity, I do something like this:
Player.Y = Player.Y + Player.Value('Gravity') * timedelta
I also have a detector that determines the 'Ground Level' of the player that is always on the ground

And then I have a variable that determines whether he's jumping or not, ie: Jumping = 1

When Jumping = 1, on a trigger once subevent, i set the gravity variable to something like -200 and on the main event i have something like this: add 100 * timedelta to Player.Value('Gravity')
Then once the player's Y coordinate is greater than the ground level detector, simply turn jumping to 0 and set gravity to 0, then if there's any loop that pushes him out of the ground now would be the time to use it. Although I suppose it's entirely possible to code without the ground detector... I really only use the ground detector in Iso type games as there technically is no ground, in platform you could just use an overlapping event

Also you're probably going to need two variables for X and Y movement, i usually just called them Xcomp and Ycomp.
Then it's simply always: set player X to player.X plus Player.Value('Xcomp') * timedelta
set Player Y to Player.Y + Player.Value('Ycomp') * timedelta
and i suppose for a platform game, you don't really need all that gravity i just mentioned cause you could treat the Ycomp variable as gravity..... oops, in which case you could just do something like: If player is not overlapping solid, add 200 * timedelta to Player.Value Ycomp

I hope that helps and I hope I've been concise enough with my description.
Need any more help I'll try and help
Posts: 351
Reputation: 2,377


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests