Author Topic: Slopes giving error message when jumping on them  (Read 595 times)

DemoTou

  • Wannabe
  • Posts: 3
  • OS:
  • Windows 10 Windows 10
  • Browser:
  • Chrome 66.0.3359.139 Chrome 66.0.3359.139
    • View Profile
  • Playstyle: Keyboard
Slopes giving error message when jumping on them
« on: April 28, 2018, 11:29:56 PM »
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

  • Cherry Eater
  • Posts: 90
  • OS:
  • Windows 10 Windows 10
  • Browser:
  • Firefox 59.0 Firefox 59.0
    • View Profile
  • Playstyle: Keyboard
Re: Slopes giving error message when jumping on them
« Reply #1 on: April 29, 2018, 08:42:32 AM »
It looks like that line will crash any time your hspeed is zero.

DemoTou

  • Wannabe
  • Posts: 3
  • OS:
  • Windows 10 Windows 10
  • Browser:
  • Chrome 66.0.3359.139 Chrome 66.0.3359.139
    • View Profile
  • Playstyle: Keyboard
Re: Slopes giving error message when jumping on them
« Reply #2 on: April 29, 2018, 09:57:04 AM »
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.
« Last Edit: April 29, 2018, 10:18:49 AM by DemoTou »