The Daily Click ::. Forums ::. Klik Coding Help ::. Whats going wrong here?
 

Post Reply  Post Oekaki 
 

Posted By Message

Nessy



Registered
  20/01/2009
Points
  361
14th June, 2009 at 22:57:34 -

So this is how I do my custom movement (Just jumping and falling)...

Always

"Top" Set X position to X("Active")
"Top" Set Y position to Y Top("Active")
"Bottom" Set X Position to X("Active")
"Bottom" Set Y position to Y Bottom("Active")
"Left" Set Y position to Y("Active")
"Left" Set X position to X Left("Active")
"Right" Set Y position to Y("Active")
"Right" Set X position to X Right("Active")

(X)Bottom is Overlapping "Group.0" +
(X)Bottom is Overlapping a backdrop +
Active: internal flag 0 is off


Special Conditions : Start Loop "Fall" Fall("Active") times

On Loop"Fall"

Active: Set Y position to Y("Active")+1

(X)Bottom is Overlapping "Group.0" +
(X)Bottom is Overlapping a backdrop +
Active: internal flag 0 is off +
Fall of "Active" < Max Fall("Active") +
Every 00"-08


Active: Add 1 to Fall

Player 1 Pressed Fire 1 +
"Bottom" is overlapping a backdrop


Active: Set Max Jump to Set Jump("Active")
Active: Set internal flag 0 on
Active: Set Jump to Max Jump("Active")
Active: Set Fall to 0

Player 1 Pressed Fire 1 +
"Bottom" is overlapping "Group.0"


Active: Set Max Jump to Set Jump("Active")
Active: Set internal flag 0 on
Active: Set Jump to Max Jump("Active")
Active: Set Fall to 0

Active: internal flag 0 is on

Special Conditions: Start loop "Jump" Jump("Active") times

On loop "Jump"+
(X)Top is Overlapping "Group.0" +
(X)Top is Overlapping a backdrop +


Active: Set Y position to Y("Active")-1

Active: internal flag 0 is on +
Jump of "Active" > 0 +
Every 00"-08


Active: Sub 1 to Jump

Bottom is overlapping a backdrop +
Active: internal flag 0 is off


Active: Set Fall to 0

Jump of "Active" <=0


Active: Set internal flag 0 off

Top is Overlapping "Group.0"

Active: Set Jump to 0

Top is Overlapping a backdrop


Active: Set Jump to 0


Everything is nearly just right, my walking movement is fine, it doesn't effect this. But what is happening is...

-Some times it jumps different heights (1-4 pixels)
-When you hit the roof and then jump where there isn't one the 2nd jump will be much shorter (5-10 pixels)

This is the only smooth jumping movement I know, I just don't know why it does this. If I have to I will learn the way other people do it, but if there is a quick fix, please tell me.

Also if you don't understand what I am trying to say and want to take a look at the MFF file I shall upload it.

 
n/a

Spitznagl

Cabinetmaker

Registered
  06/12/2008
Points
  4260

The SpinsterVIP MemberHas Donated, Thank You!Picture Me This Round 29 Winner!Picture Me This Round 31 Winner!Picture Me This Round 36 Winner!
15th June, 2009 at 00:23:28 -

A link to the file would help

 
...

Nessy



Registered
  20/01/2009
Points
  361
15th June, 2009 at 06:20:48 -

http://www.4shared.com/file/111899102/dac41bf4/The_New_Engine.html

Its not that bad on this one, but this is the one I am using atm. It is still noticeable. I have 2 things set up to test out the height of jump. You can use the arrow keys to move them around, the line is to see where the jump ends and the other thing is to jump under so you can see the difference after when you jump, also I haven't added walking in yet.

I usually use the objects values to do movement, but when I done another movement I tried with counters and the jumps where fine, but that was just luck, it's so random how it works :/

 
n/a

Spitznagl

Cabinetmaker

Registered
  06/12/2008
Points
  4260

The SpinsterVIP MemberHas Donated, Thank You!Picture Me This Round 29 Winner!Picture Me This Round 31 Winner!Picture Me This Round 36 Winner!
15th June, 2009 at 16:58:05 -

First let's answer your question.
The height difference is caused by your every 8/100th of a second condition. It depends on the timer, so if (timer mod 8 = 3), it'll take 5 frames before the action first happens. If (timer mod 8 = 7), it will only take 1 frame, but the movement always start at the moment you presses "jump".

The solution would be to; when you press jump, set a value to 8, substract 1 to it when it's bigger than 0, and set it back to 8 & take your action when it's equal or lower to 0.

Now, to be honest, your code is a total mess.
There's about 4 times the number of events needed for your character to jump. I suggest you learn with a good platform tutorial.
And here's a good one: http://www.clickteam.com/eng/resources/fastloop_plattutorial.zip

You also don't need any of those 4 detectors, and all the always conditions wich you stop by desactivating the group they're in: why not change'em for more specific conditions.

 
...

Nessy



Registered
  20/01/2009
Points
  361
15th June, 2009 at 18:12:28 -

Ooooo, I see. Thanks alot And I will look into that platform tutorial. Yeah the 4 detectors where because some times the character would go like a pixel or 2 through the floor they just help it bounce back. But I suppose a good movement won't need that.

Thanks again

 
n/a
   

Post Reply



 



Advertisement

Worth A Click