state

  1. 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) ||...
  2. J

    Checking value directly vs using a boolean

    Hey, I used to intuitively know (or a case of never really thought about the use case for each approach) but I've confused myself and would like the following clarified. In some cases why use a boolean to represent a certain condition, instead of testing the condition directly. Take for example...
  3. BlackberryKin

    2D Platformer Help - Dash State Collisions

    Hi, So I have been developing a 2D Platformer in GMS2 and I wanted to add a dash state similar to how the Knight dashes in Hollow Knight. I got a basic set-up going with different player states, but I will only be providing the dash state code. Mind you, I'm a beginner in GMS2 and game design...
  4. RacieB

    GMS 2 Four-part jumping animation

    I'm having a ton of trouble figuring out how to go about doing a complex jump animation. If it was just two parts, rising and falling, that would be really easy and I could handle that in her "bit_jump_state" script something like if vsp < 0 image_index = 0 else image_index = 1; or if vsp < 0...
  5. ruwcom

    Legacy GM [SOLVED] Interact with an enemy with a precise collission

    So I made a state where you grab an enemy and throw it away, this happens when the character is directly in front of the enemy, touching it, this works fine but when I'm walking over them, having the foot of the character touching the enemy, the code detects a collision and activates the throw...
  6. T

    Attack states

    Hello, how can I enable single button combo attacks into this? Any help much appreciated. Thanks, Lionel
  7. T

    GMS 2 How to store an objects x position on the first step of a state

    Hello, New to GMS, first game and currently working on the movement for a platformer and I'm stuck on one particular movement. When on the ground the player is in the "grounded" state, by tapping left or right on the analogue stick the player enters the "dash" state. When in the "dash" state I...
  8. K

    GMS 2 [SOLVED] Random Switch State, Idle - Wander

    Hey everyone, I'm relatively new to game maker but have been watching a lot of tutorials and reading the forums bunch and have been able to solve all of my own problems until now. Basically I have a zombie NPC, that switches between multiple states; idle, wander, alert, attack, etc. I was...
  9. M

    repeating a state

    Hello all im doing heartbeast's tutorials for games and i have a doubt in the state's of the character: for example whe i, the player, hit an enemy they change to knockback state and when they are in this state they execute the following query: case "Knockback": #region Knockback...
  10. A. DeVivo

    GMS 2 Step Event to Script and back?

    Howdy, Recently I tried to divide all my "player" step event code into scripts. However, this affected my player grav, vsp, and jumpspeed in ways that I couldn't fix by merely adjusting the numbers (very fast ascent/ impossibly slow descent). I then put the normal running and jumping code...
  11. K

    [SOLVED] Top down jumping not working

    Hello! I am very new to Game Maker, at least the coding part of it, and I have a problem with my jumping animation. The game is like old school game boy zelda games, top down, 8 directions. I have made a 15 frame animation for jumping, and whenever space is pressed, it changes jumping state to...
  12. G

    Legacy GM [Solved] State machine executes every script.

    Hello guys, I'm new here, this is not my native language so excuse me if I mess up with some words I've a really annoying problem, when I try to use a state machine it executes every script of every case, even if the variable is different. The thing is that as you can see if for example...
  13. A

    GML Enemy AI (Enemy Attack State) How would I code that? [SOLVED]

    How would I do if I wanted my enemy to come close, and then initiate the attack animation and create a hitbox in front of him? I have a state, but it's really glitchy. if (en_state == 0) { if (distance_to_object(obj_player) < 20) { state = 1 sprite_index = spr_forestspirit_atk...
  14. J

    How to Prompt an action only once?

    Hi! I am creating a game where I have enemies wandering around until they come within "sight" (variable) of the player, then they will go after the player until the players goes outside their "sight". Everytime they see the player, I want them to flash, so the player knows they enemy has seen...
  15. L

    Legacy GM Question: Statemachines and how to use them

    So, I wasn't sure whether I should post this thread here or in game design, but I decided for programming because in the end it is simply a way to clean and sector code. First things first, what are state machines? By my understanding (which might not be universally agreed upon) a state machine...
  16. Shadowblitz16

    GMS 2 good player logic?

    does anybody know how to create good super mario player logic? currently I am trying to replicate code from super mario war which is a c++ game however the code is very messy and I can see several place where they could have optimized basicly I want to know as good player code structure where...
  17. Shadowblitz16

    GMS 2 logic question about a skid state

    I have a question about the logic of entering and exiting a skid state for my player basicly I want mario to go into a skid state before turning around and going back into the idle or walk state this would only happen if the user is pressing the opposite direction of mario's x velocity and...
  18. D

    Legacy GM Would appreciate any help simplifying my code and/or getting double jump feature to work

    I'm pretty new to GameMaker and know that my code is sloppy and inefficient. All of my states are working, except for the code that has to do with the double jump. I am not sure on what is the best way to code the jumping state, and also the falling state, so I'm open to suggestions...
  19. C

    Legacy GM One way platform help

    fixed
  20. 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...
Top