It's designed for MMF2, but it uses fast loops so all the basic concepts should work in TGF2.
Hi Adam. I tried the link but it doesn't look like the file is there. Is there a copy somewhere else? Or, do you still have it that you might be able to send to me? Thanks!
Wow! Guys... I really have to say that I am overwhelmed by your generosity. I honestly had no idea the community would be this supportive. Thanks to all of you: MacAdaM, jneumann1, Adam Phant, and Julian. With the two samples (MacAdaM and jneumann1) and the David Newton's tutorial I think I have everything I need to start changing my game's platform engine from the builtin TGF2 platform movement.
Just to let you know, I've been playing these platform games for a long time and have always wanted to make my own. I think it all started when I was in high school in 1985 playing T h e x d e r on my Tandy. My goal, however, is to make something along the lines of a Halloween Harry-type game (a shooter with 16x16 tiles). I'm sure this will turn out much more basic than what you guys are used to but my goal is to have fun with it. The two parts of building the game I enjoy most: (1) creating the animated sprites (I already have the main sprite and a number of backgrounds) and (2) placing the tiles to build the levels (it's like Lego blocks!)
By the end of the week, I'll respond to this forum post with a link to what I'm working on. Since you've all been so generous with the tips, I think it is only fair that I show you what I'm trying to build. Again, it's more for the fun than anything -- so I can assure you this will be no GOTW.
Thanks again and take care!
Jess Bowers
Atlanta, GA
I've never attempted a serious platform game before, especially one without using the built in platform movements, but i must say there are alot of cool people who responded to readily to this site!
I started building my game's platform engine using David Newton's insanely good tutorial. When I make it a little farther, I'd like to incorporate some of the other ideas expressed and presented here (namely MacAdaM's pole-grabbing movement). At the moment, though, I am a bit stuck on how to incorporate "Moving Vertical Platforms" into this current engine.
The problem? I'm too dull to implement it properly and can't seem to get it to work. (even though the answer is right in front of my face)
Soooo... I was wondering if someone might be able to take a quick check at my MFA file and tell me what I've done wrong. Again, any help would be greatly appreciated. Here is the file:
I removed the bouncing by setting the player Y to the platform's Y. I fixed the resulting falling through when going up by making the detector thicker. Also, I set the player's grav to the platform's vert.
The end result is something smoother that what you had before, though it's not as smooth as it could be.
Platform Movement Object is in the bonus packs (the TGF and MMF patches and updates) so that should work I would imagine. I think TGF2 just doesn't support 3rd party extensions, those unsupported by CT.
Anyway, my trick is usually to test if he's standing on the platform, and if he is, move him at the same speed and direction as the platform.
So ideally, the platform itself should move at, say, 1px per frame. So when the player is standing on it, we add 1px to his Y speed.
Voila!
It fits neatly with my Dines-Approved way of doing platform movements, which goes thus:
Check player's environment:
--- Standing on floor?
--- Has obstacle above?
--- Has obstacle left?
--- Has obstacle right?
--- Is standing on moving platform?
Apply his movement:
--- Gravity: Either add gravity or cancel it depending on whether he's on the floor or not
--- Controls: If a button has been pressed, like LEFT/RIGHT, JUMP, whatever, add or reduce his speed accordingly.
--- Platforms: If he was standing on a moving platform, add the platform's X and Y speed to his own.
Perform his movement:
--- Actually move him, with collision detection and stuff
This way, the player is just kind of inheriting the platform's inertia!
Originally Posted by Adam Phant I removed the bouncing by setting the player Y to the platform's Y. I fixed the resulting falling through when going up by making the detector thicker. Also, I set the player's grav to the platform's vert.
The end result is something smoother that what you had before, though it's not as smooth as it could be.
Thanks, Adam! I still want the vertical platform movement to be a bit smoother but I really appreciate the help.
Originally Posted by DeadmanDines Platform Movement Object is in the bonus packs (the TGF and MMF patches and updates) so that should work I would imagine. I think TGF2 just doesn't support 3rd party extensions, those unsupported by CT.
Is the Platform Movement Object (PMO) pretty good? Do you think it's better than the fastloop custom movement? Besides the vertical platforms and ladders, I've been pretty happy with the gameplay of David Newton's engine so far. It's been pretty smooth. However, I'd love to take a closer look at the PMO if you have a sample...
Originally Posted by DeadmanDines Anyway, my trick is usually to test if he's standing on the platform, and if he is, move him at the same speed and direction as the platform.
So ideally, the platform itself should move at, say, 1px per frame. So when the player is standing on it, we add 1px to his Y speed.
Voila!
It fits neatly with my Dines-Approved way of doing platform movements, which goes thus:
Check player's environment:
--- Standing on floor?
--- Has obstacle above?
--- Has obstacle left?
--- Has obstacle right?
--- Is standing on moving platform?
Apply his movement:
--- Gravity: Either add gravity or cancel it depending on whether he's on the floor or not
--- Controls: If a button has been pressed, like LEFT/RIGHT, JUMP, whatever, add or reduce his speed accordingly.
--- Platforms: If he was standing on a moving platform, add the platform's X and Y speed to his own.
Perform his movement:
--- Actually move him, with collision detection and stuff
This way, the player is just kind of inheriting the platform's inertia!
That sounds like a plan, DeadmanDines! I've been hard at work on this custom platform engine and feel like its come a fair way:
I've also created a project for a game using the future engine:
I think I'm close, though, but need to make a few decisions about how they will work. Should the player "catch" the ladder when falling or does the player need to press the "UP" key to "catch". I'm not too sure right now -- I guess it is a matter of preference as I've seen both in different games.
NEED HELP!!!:
Also, as I am not a developer I am stuck on something you guys will probably find pretty basic. When the sprite starts climbing a ladder, I can't get the climbing animation to loop! It only plays the first frame of the climbing animation.
Mind you this only a placeholder animation until I get the whole series drawn, but, at least as far as I know, it should be animating. Can anyone take a look at the MFA file and see what's going wrong?
I used the same platform engine to make a quick platform game once, and also found that verticle platforms aren't in the tutorial. I did e-mail David however and he showed me that it's really quite simple! I'll check my old mfa to see if I can remember how I did it
Well I'll upload the game, you should play around with it a bit and see how I made the verticle moving platforms work. I forgot to get rid of the 'perspective object' before I uploaded it but if you get an error when opening the file that says something like "Perspective object could not be found" just ignore it because the object isn't vital to the game
Originally Posted by -Julian- Well I'll upload the game, you should play around with it a bit and see how I made the verticle moving platforms work. I forgot to get rid of the 'perspective object' before I uploaded it but if you get an error when opening the file that says something like "Perspective object could not be found" just ignore it because the object isn't vital to the game
Julian, thanks for making your game file available! Unfortunately, I can't open it - due to the error mentioned - and TGF2 doesn't allow me to just ignore it. Is there a way you could remove it and repost it? If not, perhaps I could use the MMF2 demo to open and remove it (though, I'm not sure).
Originally Posted by Jess Bowers Julian, thanks for making your game file available! Unfortunately, I can't open it - due to the error mentioned - and TGF2 doesn't allow me to just ignore it. Is there a way you could remove it and repost it? If not, perhaps I could use the MMF2 demo to open and remove it (though, I'm not sure).
Hey, Julian. I was able to open the file and am now looking at it. I downloaded the extension (
http://ext.neatwares.ath.cx/search/perspective/) and used the MMF2 demo. I think I should be able to import the MFA file into TGF2 once I remove the extension references.
I think I'm getting close! I eliminated the "bounce and shake" by using Julian's example. I'm still having some problems getting it right so I probably need to take a closer look at the example. The problems I am having right now are as follows:
1. When the platform moves DOWN - the sprite appears about 1 pixel above the platform
2. When the platform moves UP - the sprite appears about 1 pixel below the platform
Also, I normally set the platform "detector" to a 1-pixel width (as recommended in David Newton's tutorial). Unfortunately, with the problems I am having above I can't seem to pinpoint the platform detector with my sprite's detector -- hence allowing the sprite to jump. So, at least for the moment, I have the platform detector set to 32x16 (rather than 32x1). This was done by changing the platform's direction from 0 to 16 (which has a different graphic).
Once I get the sprite's location fixed, I think I can move the platform detector back to the 1 pixel width.
The only thing I can think of is separating the events. Make one for going up, one for going down.
Assault Andy Administrator
I make other people create vaporware
Registered 29/07/2002
Points 5686
22nd January, 2009 at 02:12:03 -
I can tell you what the problem is with the lift, but I'm not entirely sure how to fix it. As you probably know by know MMF code executes from top to bottom in a list fashion.
What is happening first is that the player is that the player is being positioned on the vertical platform, however in the last group the platform itself is moved. Thus when the frame draws the platform will have moved a tiny bit in reference to the player.
In effect it's doing this:
* Check if player is overlapping platform:
If so, put player on top of platform
* Move platform
When you want this:
* Move platform
* Check if player is overlapping platform:
If so, put player on top of platform
If you simply take the group "Moving Platforms" and place it above the group "Gravity/Jump" you can see how it changes the engine's behaviour. I'm not sure how to fix it because I haven't looked at the engine long enough, but it's to do with the order of events and perhaps you need to combine the gravity code with the moving platform code.
If you cut the lines of code under "Gravity/Jump" from "If the current gravity is not equal to zero, start the gravity loop equal to the number of times the current gravity value." to the blank green comment and paste them at the very end of your code you will see that the player stays on the platform, at the expense of glitching up other parts of the engine.
The problem was that there was conflicting code in the last lines of the "Animation" group. For the lines under the comment "When no button is pressed and the player is moving left, stop movement." I simply added "Climbing of Player = 0" to all the conditions. In a similar manner to the problem before, you were telling the player to set its animation to "stopped" and then a few lines later in the "Ladders/Climbing" group, you were telling the player to change his animation to climbing. The conditions I added check if the player is climbing, and will only change his animation when he is not.
I also added lines of code under "Ladders/Climbing" which are commented in red. These stop the animation from looping while you are stationary on the ladder, and play the animation while you are moving. I don't think it's the exact effect you wanted because you stated that you want a smooth engine. I think you will need to tweak the engine to make the character actually "snap" to the rails. But this is a start.
Originally Posted by Assault Andy I can tell you what the problem is with the lift, but I'm not entirely sure how to fix it. As you probably know by know MMF code executes from top to bottom in a list fashion.
What is happening first is ... (insert excellent explanation)
Aaaaaahhh! That makes complete sense, Andy. Thanks for the great explanation! I don't know how to how to fix that either, but I'm going to keep tinkering until I find a way. I really want the engine to be as smooth as silk and am sure there is some way to make it work.
The problem was that there was conflicting code in the last lines of the "Animation" group. For the lines under the comment "When no button is pressed and the player is moving left, stop movement." I simply added "Climbing of Player = 0" to all the conditions. In a similar manner to the problem before, you were telling the player to set its animation to "stopped" and then a few lines later in the "Ladders/Climbing" group, you were telling the player to change his animation to climbing. The conditions I added check if the player is climbing, and will only change his animation when he is not.
THANKS!!! I am more of an aging gamer with dreams of being a pixel artist than a programmer. I really appreicate your help on this! I posted your edited version up to my site so that anyone downloading it will get your revised version. Developing this game (once the engine is finished), will become much more fun for me as I get to create all of the cool and interesting enemies and traps for the player to evade.
Originally Posted by Assault Andy I also added lines of code under "Ladders/Climbing" which are commented in red. These stop the animation from looping while you are stationary on the ladder, and play the animation while you are moving. I don't think it's the exact effect you wanted because you stated that you want a smooth engine. I think you will need to tweak the engine to make the character actually "snap" to the rails. But this is a start.
Again, I really appreciate you taking the time to look at this! You're right-- I do want the character to "snap" to the ladder rails. I've seen a few ways that ladders were implemented and need to play around with that ladder code to get that "perfect feel" to them. My current thinking (which may change) is that the character should stick to the ladder when jumping - but only on the DOWN part of the jump. This would allow the player to essentially JUMP on the ladder and then STICK the character only when they started to FALL (rather than have the character fall all the way to the ground which is what happens now). Also, the "snap" should lock the player to the center of the ladder. I think that can happen with a reset of the players X coordinate when they start climbing (not sure how yet, though). I will probably work on the climbing animation before I work on that code.
Originally Posted by Assault Andy Good luck and keep us posted.
Absolutely! You guys have all been extremely cool and helpful. I just hope that the final product is (1) fun to play, and (2) someone likes the final graphics enough to "leverage" a few pieces. Either way, I'm having a lot of fun with this project.