state change

  1. A

    GML What function would allow a state to be switched upon picking up or colliding with a weapon object?

    Hey everyone, I posted a few days with a conceptual coding problem and I just realized that there is a much larger issue with the code responsible for switching my character's state. I need to be able to switch from my Idle state into my alternate running animation when my character picks up...
  2. A

    One of my animations will not play but the code appears to be functional

    Hello everyone I'm having a bit of a hard time with my game. I recently began using states in the class I'm taking to help program my game. The idle animation appears to be working for my enemy object, however the jumping start state does not work at all. The instructor split the jump into...
  3. S

    Windows Problem with Ladder State Machine

    Hi i'm making a platformer/metroidvania and I'm new to Game Maker Studio 2. I'm having difficulty getting a ladder state machine script to work due to an error. Here's my code: scr_getinputs(); hsp= 0; vsp= 4* (key_down -key_up) x = (instance_nearest(x,y,oLadder).x) if (key_jump) ||...
  4. T

    GML [KNOWN BUG -- MACOS COMMAND KEYS] State machine glitch - inputs from one state (stationary) repeating infinitely when returning to free state

    I have a state machine and the "playerStateHide" has some issue with executing that I can't seem to figure out. I know it has to do with calling playerStateFree at the end of the hide function, as when I remove that line of code and mapped playerStateFree to a keybind, the glitch did not occur...
  5. B

    Need help implementing state machines

    Hey, so I have been working on a top down RPG and I am trying to implement a state system to switch the players states i.e ( idle, movement, sprint,attack,etc). I'm fairly new to GMS(I'm using GMS 1.4.9999) and have some minor coding experience. The problem I am stuck with is that when the...
  6. A

    Legacy GM [SOLVED] Built-in speed/state change interfering with slopes...?

    Hola! I'm having a crack at an endless runner variation, where instead of objects coming towards the player, the player is constantly moving forward. I've tried modifying an existing movement script so that this happens, and it works, but every time I change into the attack state on a slope...
  7. J

    Help with states

    Hello, I'm experiencing an unintended issue in GML. I'd like for the object (player) to press a key, then transition into a given state like roll or attack one, then return to the move state. What's happening instead is when I boot up the game, without pressing any keys, the object immediately...
  8. E

    Collision event not changing state.

    Within my step event of obj_Enemy_1 I have three states. Currently, in the "Attacking" state I have the following: case "Attacking": var attack_angle = point_direction(x, y, obj_Player1.x, obj_Player1.y); var shot = instance_create_layer(x, y, layer, obj_Enemy_laser)...
  9. E

    Use a "Switch" statement with a "With" construction.

    Sorry if my code is a bit of a mess. I've attempted numerous things without luck and this is what I currently have. case obj_Robot_1: with (obj_Robot_1){ mp_potential_step(obj_Player1.x, obj_Player1.y, 2, true); if obj_Robot_1.y >= room_height /2{ state =...
  10. Caio

    GML Attack Animation

    Hi I'm using as a base: https://marketplace.yoyogames.com/assets/3437/character-controller I am trying to put attack in the game, but at the time of the attack the image appears very fast or appears only the beginning of the animation of the sprite. I'm using GMS 2. My obj_player: ///Create...
  11. Doc

    GameMaker Set a newbie straight: state machine vs. instance switch

    Hello all! I'm hoping this question will stir up some opinions for me to learn from :) So I have seen and implemented a simple state machine in a game (to say that I understand how script based state machines work). Alternatively, in what has turned into my "main" get a game finished...
  12. C

    Cannot Move After Attack Animation

    Hello! Yet another cry for help from yours truly. I have an attack state set up for my platformer character. When I press the attack button, my player object switches from (state = script_move_state) to (state = script_attack_state) which basically just has the attack animations in it. For...
  13. A

    GML F = State Attack, but the sprite animation only lasts a frame, using state machine. SOLVED

    So, basically, when I press F it should change the player state from idle to an attack state, but the problem is it only lasts one frame, I'm wondering how I could do to make the whole sprite animation play to the end and then change back the state to idle. Code: scr_input(); if (state == 0) {...
  14. X

    attack animation while character or player is moving

    i use heartbeast rpg tutorial for attack state but the character stop to play the animation i was if some one can give me a clue to how to get him to attack while moving here is the code for the player create event obj_player ///Initialize Variable // The Game main gravity grav = 1; // Player...
  15. D

    Windows A decent bool 'Switcher' states

    Hello GMers ! I want to create a state 'switcher', which each state could be a bool variable. But that will allow only ONE state to be true at time. I'd like, from different event, call the switcher with a argument that will turn off all other states and turning on the one asked. stateA =...
  16. V

    Legacy GM Camera stops following player

    As I was adding up more mechanics to my game I noticed that, for some reason, whenever my character is in his defense state script and moving, the camera stops in place, going back to following him when he stops moving or goes to another state. ///create camera...
  17. Luke Pierson

    Having non-physics object collision issues in a physics world

    I'm completely lost. I had spikes in my game. The hero would die if he collided with them. I added an arrow trap into the game, which required activating the physics in the room. Now he doesn't enter the death state when he touches the spikes. I even removed the arrow trap from the room and...
Top