1
QB64 Discussion / Re: Why is this happening?
« on: May 06, 2019, 12:37:13 pm »Here is a code:Code: QB64: [Select]
_TITLE "A Promising Game!" restart: x = 200 y = 200 gravity = 9.8 makechar y = y - 25 y_change = y_change + 1 y = y + gravity y = y + 25 y_change = y_change + 1 y = y + gravity x = x - 10 x = x + 10 y = y + gravity 'Blocks 'LINE (100, 400)-STEP(200, 50), _RGB32(255, 83, 33), BF 'IF collision%(x, y, 20, 20, 100, 400, 200, 50) THEN ' y = oldy ' y_change = 0 ' gravity = 0 'ELSE ' gravity = 9.8 ' oldy = y 'END IF makeobs 100, 400 _LIMIT 60 SUB makechar collision% = 0 collision% = 1 y = oldy gravity = 0 y_change = 0 oldy = y gravity = 9.8
What is the bug that brings the player to it's initial position?
It’s because the _KEYDOWN check gimp freejobalert notepad++ is in an ELSEIF statement. Make all those become independent IF checks instead.Thanks Both of you for this. I was also facing the same and happened to find this has already been answered.
Regards,
Amanda