Official Fangame Help Topic


The else if is redundant <.<
Just do else.

But anyway. I don’t see why that wouldn’t work. Is there any other part of the code that might be causing this code not to run, for instance?

EDIT: Oh, you also might want to check 3 locations for extra pixels. Not just under the morph ball, but over it, and over the ground.


Aye, this is partly what I meant by the above statement. You’d probably want a more-left and more-right check as well as the center check.

And the else if insures that the code doesn’t act if the morphball is moving upward, because of course moving upward is a negative vspeed, and thus is less than zero. Morphball moves up when bomb jumping.


well i was going to pour over my code and see if anything else was messing with it to make it have this odd malfunction
but i was dragged away to throw wood into a truck all day

$35 was NOT worth that -.-


im going to start that NOW so i can hopefully find it, if its there, and fix it

this ball with BOUNCE

or it will BOUNCE IN HELL!


i think it may have something to do with my gravity

//gravity// if (keyboard_check_direct(vk_down)) && vspeed!=0{ ? ?gravity=place_free(x,y+13)/1.25} else{ ? ?gravity=place_free(x,y+13)/4}

i added in the higher gravity with the down key and it stopped bouncing completely <____<


disregaurd the gravity idea, it still wont bounce and i put it back to normal



Well, make sure your graviy acts under all conditions unless there’s ground below the morphball. And what does your bouncing code look like? Usually it should be as simple as dividing the vspeed by a number < -1. Aside from those, my only guess is that some other code is interfering and pushing it back up, somehow, or maybe it’s in a flux of constantly changing vspeed when it looks like it’s floating. The GM debugger can be handy at times like this.


if (morph && vspeed > 0 && place_meeting(x,y+4,object1)) { if (vspeed < 3 && vspeed != 0) { &nbsp;vspeed = 0; &nbsp;while (!place_meeting(x+sprite_width/2,y+sprite_height,object1)) &nbsp;{ &nbsp; y += 1; &nbsp;} } else if (vspeed >= 1) { &nbsp;vspeed = -(vspeed/2); } }

thats the bounce code


I’m guessing that code is in the collision event with object1?

Well, it’s not going to bounce if you’re falling at a vspeed less than 3, because if it is, that if clause gets to it before the else if, and sets the vspeed to 0. (Maybe you want this?)

If you plan to have the morphball rolling up and down slopes, this may need reworking altogether, as that code could easily interfere with going down slopes. You might try only using GM’s vspeed variable for vertical movement in the air, and use your own system of manipulating the y value for slopes.

Shorthand for the line that makes it bounce would be vspeed /= -2;.

For the heck of it, I’ll play out a simple scenario:

Falling at vspeed of 10.

Bounce off ground; vspeed is -5.

Come back down. Bounce; vspeed is -2.5.

Come back down. Stop vspeed entirely, because the vspeed is less than 3.

And another:

Trying to start rolling down a slope. If there is accelleration and not just instantaneous speed, you may move horizontally, but won’t move vertically until there is no ground underneath you, because the vspeed is constantly being set to 0 by the vspeed < 3 test. (Actually this might have been the case, but I believe the while loop would keep you on the ground xP)

I hope perhaps this might help you figure out what you might need to do. I apologize for not writing much actual code for you >.>.


i though of the slope thing, and planned of fixing that in the future
and yes, i do want it to stop bouncing once it gets under 3

still floats…


to get a better idea of what im talking about
view it for yourself!

i know there are many many errors and things

and i suggest not jumping down that hole


Hmm… I’ll refrain from commenting on or suggesting anything aside from the morphball. :slight_smile:

But yeah, strange. It isn’t always 2 pixels, either. (I got 1 on one occasion.) And if you try to un-morph after bouncing, you just disappear? Strange. Does something else change after having fallen as a morphball? I’m wondering too - if the morphball is the same object as the character, would perhaps some of the character’s non-morphed code be interfering somehow? I can’t tell 'cuz I don’t have the code, but that might be something to look for.

Also, are you using GM’s built-in gravity, or your own gravity? I highly suggest using your own, if you’re not already.


i can send you my code if you want xD


it IS my gravity that is causing the problem

i must now make a new one


Yay, glad you figured it out :stuck_out_tongue:. I was considering taking a look at the editable you sent me, but if you think you’ve got it, I won’t bother. :slight_smile:


if i could figure out how to program gravity xD

being tired and programming doesnt work xDDDD


Ah, gravity is fairly simple. Obviously, gravity is an accellerating force, so therefore, to program gravity you use something like vspeed, and increase it each step (unless there is ground below the affected object, or any other of tons of conditions you might not want gravity to act in.)


everything i try makes it so my jump freaks out xD

i’ll figure it out tommorow


i accidentally made it worse
now you fall into the floor while in morphball
and then it freezes xDD


forgive the double posting


it is now FIXED
and rather good too =DDD

thanks for the help =D


You mean NOW fixed, I’m guessing?

Well that’s good! Glad I could help. Glad you could figure it out, as well. Programming is often all about figuring out the necessary code on your own - that’s how you get better, aye.


so, them wall jumps <____<
they "work"
but are hard to get to work
so i downloaded a tutorial/example or what ever you wanna call it

and it does the same exact thing

so im confused about these jumps from walls and need some assistance

yeah, im good at this sarcasm

[code]if (vspeed >= 0 && jump && wj > 0 ?&& !duck && !morph)
? ?if ((place_meeting(x-14,sprite_height,object1)) && (keyboard_check_pressed(vk_right) && (keyboard_check_pressed(‘X’)))
? ?{
? ? ? ?wj -= 1;
? ? ? ?vspeed = -7;
? ? ? ?jump = true;
? ?}
? ?if ((place_meeting(x+14,sprite_height,object1)) && (keyboard_check_pressed(vk_left) && (keyboard_check_pressed(‘X’)))
? ?{
? ? ? ?wj -= 1;
? ? ? ?vspeed = -7;
? ? ? ?jump = true;
? ?}


current code


Eh, well, as it is, one would have to press the directional button and X at the EXACT SAME TIME, or rather the same frame in the game, which is not very easily acheived. I’d reccomend changing the directional key checks to simply keyboard_check, removing the _pressed.


i did not realize, i shall try this

still not quite working