Fangames > Programming Questions

Slopes giving error message when jumping on them

(1/1)

DemoTou:
Hey,

I'm using GMStudio 1.4 and YoYoYo's engine for it.
I'm very new and never had any contact with making games or coding so if the problem is obvious I'm sorry for bothering.
At the moment I just started making a fangame and wanted to add slopes but sometimes when I jump on them (maybe like 50% of the time) I get this Error and have no Idea what I'm doing wrong.

https://gyazo.com/a356c4bdc0cd150674e88ea8bf0be4550
https://gyazo.com/e9c707eba7184abde71547c133b29749

___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of  Step Event0
for object objPlayer:

DoDiv :: Divide by zero
 at gml_Object_objPlayer_StepNormalEvent_1 (line 209) -             while ((!place_meeting(x+hTest,y-ySlope+(global.grav),objSlope) || (onSlope && !place_meeting(x+hTest,y-ySlope+(global.grav),objBlock))) && ySlope*global.grav > -floor(moveLimit*(hTest/hspeed)))
############################################################################################

I hope someone can help me, thx for any incoming help. :)

WetWookie:
It looks like that line will crash any time your hspeed is zero.

DemoTou:
I'm sorry but I guess I kinda know what that means but I have no idea how I would be able to fix it :S

I just tested a bit more when exactly it crashes, it crashes every time I keep pressing left or right and land on the slope. If I just stand on it and jump without moving it doesn't crash. Like I said I'm very new here so I have absolutely no idea how to fix this or what would cause this. I assumed the slopes from the Engine would just work (I didn't change anything with them) so idk how to approach this.

Navigation

[0] Message Index

Go to full version