Topic: How do I do thing in "Game Maker" (Read 392 times)

  • Avatar of dondogydensien
  • Group: Member
  • Joined: Sep 1, 2013
  • Posts: 42
I'm new to Game Maker and making games so I have some really dumb questions to ask anyone who will answer me. I was scared of posting my questions in the other thread so I'll post them here.
 
First question: How do I set animation speeds for individual sprites/objects? I can't find where the setting is and when I test launch the game all the animations are comically fast. figured that one out
 
Thank you! I'll post more once I run into more problems.
Last Edit: September 15, 2013, 12:12:10 am by dondogydensien
  • Avatar of dondogydensien
  • Group: Member
  • Joined: Sep 1, 2013
  • Posts: 42
How do I make it so my character can move in two directions at once (aka up plus right moves in a diagonal) ??
  • Avatar of Warped655
  • Scanner
  • PipPipPipPipPipPipPipPip
  • Group: Member
  • Joined: Mar 25, 2004
  • Posts: 2416
I have not used gamemaker in a long time but when I get home I'll see what i can find out for you.
  • Administrator
  • PipPipPipPipPipPipPipPip
  • Group: Premium Member
  • Joined: Oct 30, 2005
  • Posts: 2534
Can't you do a "when you hold up you add/subtract from y postion." Then when left/right is held then you add/subract from x position.
I haven't used it for like 8 years but I know that GM is sort of event-driven so the concept should work.
 
What version are you using btw?
  • Avatar of dondogydensien
  • Group: Member
  • Joined: Sep 1, 2013
  • Posts: 42
Game Maker 8. Also thank you, I'd been assigning key presses to the "move in a direction" command which didn't allow that. It works now.
 
Another question: when I press and release the directional keys too quickly in succession, they get stuck and the character stops moving entirely and I have to release all the keys before pressing anymore so that the character will move. Is there a workaround to this? For my "release key" events I have the game set the vertical or horizontal speed to 0.
Last Edit: September 15, 2013, 01:07:54 am by dondogydensien
  • Avatar of Warped655
  • Scanner
  • PipPipPipPipPipPipPipPip
  • Group: Member
  • Joined: Mar 25, 2004
  • Posts: 2416
Hmm, I would just have a step event that constantly reduces the speed by some amount when no move keys are pressed. It might fix your problem and plus that way you have some level of friction instead of instant stop unless that's what you are specifically aiming for. I'm a little tipsy atm so my ability to think critically is poor sorry if I wasn't much help. I see if I can't be more help tomorrow.
  • Avatar of Ice Baby1
  • Power to the parsley
  • PipPipPipPipPip
  • Group: Member
  • Joined: Oct 31, 2012
  • Posts: 637
how much gml are you comfortable with? one simpler way to handle movement is to forgo keypress/release events and control gm's built-in hspeed/vspeed variables in the step event. if you had a top-down game with arrow key control you might have something like this.

create event:
friction = 0.2;

step event:
if keyboard_check(vk_left) {hspeed -= 1;}
if keyboard_check(vk_right) {hspeed += 1;}
...etc.

this makes motion a little slidey. you can mess around with the speeds and friction as you see fit. if you want more precise movement, you can ignore the speed and friction variables and instead increment x and y values.
 
something like that is a lot easier to keep track of and change around than a bunch of separate events. if you don't want to use gml, it can be adapted to drag n drop pretty easily. any questions? i'm afraid i don't have the excuse of being tipsy if this doesn't help you much!!!
Last Edit: September 15, 2013, 01:43:04 am by gods17
  • Avatar of dondogydensien
  • Group: Member
  • Joined: Sep 1, 2013
  • Posts: 42
I'll have to admit that I know absolutely nothing about either coding or game maker, and even less about coding within game maker. I'd like to avoid that sort of thing as much as possible. That said, how easy is it to do what you are talking about? Also, I'm taking a look at the step event and I'll see what I can do with it. Thank you both.
  • Avatar of dondogydensien
  • Group: Member
  • Joined: Sep 1, 2013
  • Posts: 42
So, I couldn't exactly figure out steps, but I tried making it so the press of a directional key sets a variable's value to 1 and a release of the same key sets that variable's value to 0 and I made a step event saying that if all 4 variables = 0 the game would set the horizontal and vertical speeds of the character to 0. However, when I launch the game, it just gives me an error that it doesn't recognize the variables and I can't move on. Am I supposed to create the variables somehow before using them?
 
Edit:  :fogetunsure:
 
Edit 2: That ended up not working anyway. Regardless of whether or not a key was pressed the step event thought it wasn't anyway and decided to not let me move.
 
Edit 3: Solved.
Last Edit: September 15, 2013, 03:42:52 am by dondogydensien
  • Avatar of sambr
  • Pip
  • Group: Member
  • Joined: Aug 7, 2012
  • Posts: 193
what that code is trying to do there is reference another object named "local"'s right variable. that's how game maker references other objects variables. what you have to do is in the create event, put something like
right = 6942069 (change this please)
and then, in whatever event your current code is in, just put
right = 0
and then you should have it..
sorry if that wasn't clear
  • Avatar of dondogydensien
  • Group: Member
  • Joined: Sep 1, 2013
  • Posts: 42
what that code is trying to do there is reference another object named "local"'s right variable. that's how game maker references other objects variables. what you have to do is in the create event, put something like
right = 6942069 (change this please)
and then, in whatever event your current code is in, just put
right = 0
and then you should have it..
sorry if that wasn't clear
Oh jeez thank you this actually helped me tremendously though not exactly in the way you planned it to. Removing the "local." from the variables solved my second problem I had after I had already figured out the first one haha