The Daily Click ::. Forums ::. Klik Coding Help ::. Please point me in the right direction - platform movement
 

Post Reply  Post Oekaki 
 

Posted By Message

Jess Bowers

Cake > Pie

Registered
  09/01/2009
Points
  310

Has Donated, Thank You!GOTM FEB - 2010 - WINNER!GOTW Winner!
10th January, 2009 at 07:40:39 -


Originally Posted by Adam Phant
Here's a well-written tutorial, with examples, by David Newton: http://clicktutorial.byethost9.com/zips/plattutorial.zip

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!

 

-J-



Registered
  05/10/2008
Points
  228

VIP MemberThe Cake is a Lie
10th January, 2009 at 08:13:30 -

http://www.clickteam.com/eng/resources/fastloop_plattutorial.zip . . .

 
n/a ...

Jess Bowers

Cake > Pie

Registered
  09/01/2009
Points
  310

Has Donated, Thank You!GOTM FEB - 2010 - WINNER!GOTW Winner!
10th January, 2009 at 16:44:32 -

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

Edited by Jess Bowers

 

Marko

I like you You like you

Registered
  08/05/2008
Points
  2804

Has Donated, Thank You!Game of the Week WinnerVIP Member360 OwnerDos Rules!Happy FellahCrazy EvilI am an April FoolGingerbread House
10th January, 2009 at 18:45:02 -

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!

 
Image

Subliminal Dreams. . ., daily gaming news and the home of Mooneyman Studios!
www.mooneyman-studios.webs.com

Jess Bowers

Cake > Pie

Registered
  09/01/2009
Points
  310

Has Donated, Thank You!GOTM FEB - 2010 - WINNER!GOTW Winner!
13th January, 2009 at 19:32:49 -

Hey guys!

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.

I emailed David Newton and he gave me the answer:

http://theclickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=97723

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:

http://www.jessandmichelle.com/files/Platform.mfa

I'm trying to get the vertical platform movement as smooth as the horizontal platform movement.

Thanks!!
Jess


 

aphant



Registered
  18/05/2008
Points
  1242
15th January, 2009 at 12:48:33 -

http://www.pfordee.com/psychophan7/alpha_zero/Platform_better.mfa

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.

 

DeadmanDines

Best Article Writer

Registered
  27/04/2006
Points
  4758
15th January, 2009 at 13:46:21 -

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!

 
191 / 9999 * 7 + 191 * 7

Jess Bowers

Cake > Pie

Registered
  09/01/2009
Points
  310

Has Donated, Thank You!GOTM FEB - 2010 - WINNER!GOTW Winner!
19th January, 2009 at 07:54:13 -


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:

Image

I've also created a project for a game using the future engine:

http://www.create-games.com/project.asp?id=1440

Features in the engine that work so far include:
- Variable Height Jumps
- Double Jumps
- Moving Platforms (Horizontal)
- Conveyors
- Springs

Features in the engine that aren't fully implemented:
- Ladders
- Moving Platforms (Vertical)
- Shooting (which shouldn't be hard)

As for the moving vertical platforms, DeadmanDines, I think I need to implement your recommendations. Hope I don't blow it, though!

On the topic of ladders, I'm not the only one struggling to add them to David Newton's engine right now:
http://theclickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=123921#Post123921

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.

Image

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?

http://jessandmichelle.com/files/plokey/Plokey-Engine.mfa

Thanks!
Jess

 

-J-



Registered
  05/10/2008
Points
  228

VIP MemberThe Cake is a Lie
19th January, 2009 at 10:21:29 -

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

Here it is:

http://sites.google.com/site/julianmsmithies/Home/JailBreak.mfa?attredirects=0

 
n/a ...

Jess Bowers

Cake > Pie

Registered
  09/01/2009
Points
  310

Has Donated, Thank You!GOTM FEB - 2010 - WINNER!GOTW Winner!
19th January, 2009 at 15:41:25 -


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).

Thanks!

 

Jess Bowers

Cake > Pie

Registered
  09/01/2009
Points
  310

Has Donated, Thank You!GOTM FEB - 2010 - WINNER!GOTW Winner!
19th January, 2009 at 21:55:40 -


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.

Edited by Jess Bowers

 

Jess Bowers

Cake > Pie

Registered
  09/01/2009
Points
  310

Has Donated, Thank You!GOTM FEB - 2010 - WINNER!GOTW Winner!
21st January, 2009 at 16:56:53 -

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

Image

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.

Any ideas? The MFA file is here:

http://jessandmichelle.com/files/plokey/Plokey-Engine.mfa


 

aphant



Registered
  18/05/2008
Points
  1242
21st January, 2009 at 17:50:57 -

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

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
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.


In terms of the ladder animations, I managed to fix them:
http://www.mediafire.com/download.php?nndy2dykkjj

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.

Good luck and keep us posted.

Edited by an Administrator

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Jess Bowers

Cake > Pie

Registered
  09/01/2009
Points
  310

Has Donated, Thank You!GOTM FEB - 2010 - WINNER!GOTW Winner!
22nd January, 2009 at 05:19:34 -


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.


Originally Posted by Assault Andy
In terms of the ladder animations, I managed to fix them:
http://www.mediafire.com/download.php?nndy2dykkjj

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.

 
   

Post Reply



 



Advertisement

Worth A Click