Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

GM8 script that worked before, but doesn't work ANYMORE!

Hi! I am using Game Maker 8

I am using the following information for my "Player.Object":

CREATE:
CODE:
grav=.3;
mspeed = 8;

STEP:
CODE:
if (place_free(x,y+1)) {
gravity = grav;
}else{
gravity = 0
}

COLLISION -><- WITH "GROUND":
CODE:
vspeed = 0;

SPACE BUTTON:
CODE:
if!(place_free(x,y+1)) {
vspeed -= 8;}

This scripts are used to make a character JUMP, and I have used them sooo many times before, but suddenly it doesn't work at all!

It is a bug because it just randomly popped up, and when the scripts worked one second earlier too!

Look at this VIDEO if you want a clearer explanation (please look in FULLSCREEN):

http://www.youtube.com/watch?v=V910V-MoIZo

PLEASE HELP ME! I am mad at Game maker because I have experienced so many random and unlogical bugs!

/Thank You
 
Like the error message says, GM doesn't recognize the variable grav

Variables in GM8 are local to objects. If you are going to write a variable in code you need to tell it where that variable is.
instead of:
grav=.3
it needs to say:
mario.grav=.3

But since gravity is a built-in variable I'm assuming you want to make a global variable for grav.
To do that you need to call it:
global.grav=.3
This way you can have all your objects gravity equal to one variable.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top