Well, MMF2 has been sat on my shelf doing nothing for a good few months now. Today I decided that it was time I left TGF alone and kicked it up a knotch with MMF2.
I also decided to start doing custom movements, too... Got my left/right movement and very basic gravity done but I'm very stumpped at jumping. I can't really seem to think of a way around it. Maybe with a counter/value/etc? Whats the easiest way? Oh, I do have another problem: getting the falling animation to play properly.
Bottom detector not overlapping BG -> Player Y Pos -2 + change animation to "falling"
With that the animation will not play. It changes but sticks at frame 1. Is this because its constantly setting the animation to "falling"? If so, how could I correct this? Thanks for any help
the way i do it is make the objects y value relate to a value (a counter or an alterable value that i call 'jump')
(make characters y value related to it's y value + 'jump')
then have three modes (also an alterable value)
stop = 0
rise = 1
fall = 2
so 0 makes the 'jump' value 0
1 makes the jump value subtract
2 makes the jump value add
then it's a matter of pressing a button to make the value 1 until you've jumped enough (jump = -25 set jump mode to 2)
then hitting the floor will make jump mode 2.
well thats how i used to do it, it's not really very good because you'll sink into the floor.
I have an alt variable called JUMP CEILING that when the player presses the jump button , JUMP CEILING is set to the player's Y position - 40 and a flag is set to on. Then, while that flag is on you have an event that subtracts -2 to the player's Y position. When the player's Y position <= JUMP CEILING, then you turn the flag off and he'll fall.
It's way more complicated to get it to not look like crap though, which is something I'm working on at the moment myself
--
"Del Duio has received 0 trophies. Click here to see them all."
"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"
DXF Games, coming next: Hasslevania 2- This Space for Rent!
Peblo Custom ratings must be 50 characters or less
Registered 05/07/2002
Points 185
26th July, 2007 at 21:51:11 -
Oh... dear.
You should keep watch for better jumping methods.
"Isn't it always amazing how we characterize a person's intelligence by how closely their thinking matches ours?"
~Belgarath
Yeah I know. I've been trying to work Phizzy's awesome examples into my own but mine is too over-complicated and integrated to be changed too much and have it work. Worst of all is the friggin' hype over this thing is getting ridiculous, in a bad way if I can't cut the mustard!!
--
"Del Duio has received 0 trophies. Click here to see them all."
"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"
DXF Games, coming next: Hasslevania 2- This Space for Rent!
* Player isnt on the ground: increase his y speed by some constant rate (that would be the force of gravity) (If he is on the ground, set his y speed to 0!)
* Always set position y = current position + y speed (Not this basic, of course, you probably want to use the fastloop method that moves an object 1 pixel at a time and such, or whatever applies to your specific engine!)
* player pushes jump key, set the y speed to some negative number. Maybe -7 for an example, this will launch the player up in the air.
* with the gravity always acting, everything will take care of itself! The player rises into the air, and falls back down with a perfect parabola if you did it right. ;D
I hope that was clear. I'm very tired and I didnt go into any detail :I
I do it Xerus' way, but with a slight modification:
Set Position of Player to Y(Player)+ Alterable Value A (Player)/3
If you make the engine without the "/3" part the player will fall down very quickly. Of course, you can change the 3 to a 4, or even a 5... it depends on what sort of game your engine will represent.
I seem to be having a problem with the fast loop though. I tell it to move the player up 1 pixel and to loop 60 times. So its just positioning the player up there right away, not pixel by pixel... How do I get this part a workin'? (I'm horribly new to this, ugh)
Edit: Oops, my bad. Still went through the ceiling though Its like its just ignoring the fast loop and just positioning the active object there right away. I'm really confuzzled. :S
Uh slink, the point of fastloops is that it does everything in one (TGF/MMF) loop
Your character did indeed move up one pixel at a time, it's just that all those 60 loops ran so fast you couldn't see it. You need a "stop loop" event in there.