• Hey! Guest! The 40th (!!!) GMC Jam will take place between February 25th, 12:00 UTC to March 1st 12:00 UTC. Why not join in this very special anniversary jam! Click here to find out more!

direction

  1. Misael644

    SOLVED Event collision problems involving multiple instances.

    Hello again! I'm here because I'm having problems with my game's collision event. Basically, I'm trying to simulate a starfield that works like this: I have an object called "obj_star", in the game, it is spawned by "obj_starcreator", which spawns a star in a random place on the screen. And so...
  2. M

    direction problems with enemy object...

    So in my top-down game sometimes the enemies run away from the player. I added mp_potential_step to the enemies' running away code, but then it got difficult. I had to somehow add the directions away from the player to the enemies' mp_potential_step_object() code. this is to make the enemies...
  3. V

    Legacy GM lengthdir_x,y help

    Heyall, I'm trying to skip the trigonometry because it's just not working for me regarding all the different negative numbers i'm working with. I want to jump from x,y1 at an angle (direction) of 280 degrees and 100 pixels in said direction in order to land on x,y2. I cannot for the life of me...
  4. F

    Change direction attacking

    My character when attacks, he turns only to the right. I can't make he turns to left and attack looking to left while walking. He turns if he's stopped, but if he's not, the animation change to the right. if keyboard_check(vk_space){ sprite_index=character_Attacking_Right;image_speed=1; }...
  5. josyanf1

    GMS 2 [SOLVED] Discover 'direction' with hspeed and vspeed positions

    Hello! I am trying to discover the direction variable having the hspeed and vspeed positions. Since if you use hspeed or vspeed the direction variable gives 0. I'm a little lost, can someone help me? :S Thanks in advance ^^
  6. M

    instances remain static after assigning a speed of 8 and direction of 90, why?

    Hello Community This beats me. I have converted a game from GM 1.4 to GM2. Game worked fine in GM1.4 but now all my instances that have speed assigned to them do not move! for example i shoot bullets they remain static on the screen. GM Support refuse to help even tho the bug appeared after...
  7. M

    how to check if the player is facing an enemy

    Hey guys, this one I thought would be simple, but since 'if direction = point_direction(x,y,enemy.x,enemy.y)' etc. is a 'malformed statement' and I cant figure out anything here... how do you check: if obj_player is looking in direction of obj_enemy : stuff happens? thanks beforehand!
  8. F

    How do i achieve "slippery movement" / difference between two directions

    So i want to create an enemy AI that charges tword a player but has like a simulated friction/delay. kinda like as if it were running on ice, so it starts still and builds up speed in your direction to try and ram you. But if you dodge him he shouldnt continue moving tword you but in the...
  9. J

    [Solved] Image-Angle affecting direction in Space Rocks tutorial

    I'm currently going through the space rocks tutorial and am creating the asteroid's behaviour. The tutorial tells you to change the object's image_angle each step to create a rotating effect, so that it doesn't affect the asteroid's actual direction value. When testing this behaviour, the...
  10. Alaska Minds

    Object Sprite Direction Tutorial (8 Directions)

    GM Version: Studio 2 (Possibly later versions of Studio 1) Target Platform: Any Download: None (Code below) Links: round(), point_direction(), switch, sprite_index, image_speed Summary: Hello all I'm going to show you how to change your Object's sprite, based on direction. It all starts...
  11. Jmarlin3

    Trouble with direction and horizontal speed

    I'm having trouble correctly programming the direction I want one of my objects to move. When Z is pressed, Obj_player_head is supposed to move the direction relative to what obj_player.image_xscale returns (this being 1 or -1). The problem is that while it does move to the right when Z is...
  12. R

    Path and image angle and direction? How do I combine them?

    So I have a path set... and I have my object on the path... and I have the sprite set to go along with it... How do I make the image rotate to follow the path it is going on? It seems like there is just something easy I am missing but for the life of me I haven't been able to find the correct...
  13. A

    [Solved] Issues with Paths, Direction, and Animation

    For context, I'm working on a top-down, tactics-style game. While the player is in battle, they pull up a menu, and to move, the player selects "Move" from the menu. From there, a grid selector is created, and each time the selector moves, it adds a new point to a created path. When the player...
  14. FoufaDjo

    GMS 2 [SOLVED]keep same direction when colliding with wall

    when the object move to the left and collide with the wall he stop moving but change is direction to 0 how can i fix that spdmax = 2; accel = 0.5; friction = 0.3; if rkey hspeed += accel; if lkey hspeed -= accel; if dkey vspeed += accel; if ukey vspeed -= accel; speed =...
  15. FoufaDjo

    GMS 2 [SOLVED)How can i save previous value of an variable

    am making a knockback system and am stuck at returning the knocked player direction to his original direction here is the code: //Knockback knockback = max(knockback-3.4,0); if knockback = 0{ knockbackon = 0; } if knockback > 0{ knockbackon = 1; } if knockbackon = 1{ direction =...
  16. W

    GML Physics: Bullets Not Shooting Straight W/ 360 Aim

    Hi, I can't seem to get the player's projectiles to shoot straight using physics. In the game I'm making the player has 360 degree aim. Currently bullet direction is decided by phy_roations = obj_player.phy_rotation. It does the job for the most part except the trajectory of the bullets are...
  17. P

    GMS 2 Knockback Direction Broken?

    I'm trying to knock back my player in the opposite direction he shoots his gun. But it only seems to be working on vertical directions... PLAYER CREATE EVENT hspd = 0; vspd = 0; hspd_force = 0; vspd_force = 0; force_applied = 0; force_dir = undefined; spd = 2; PLAYER STEP EVENT // Inputs var...
  18. qbot21

    GMS 2 Changing Player's movement speed depending on direction

    Hello :) Im working on TDS prototype with a bit tactical approach. What I want to achieve, is that Player's speed is reduced, when he is moving backwards and making sidesteps depending on direction he is facing. Sadly I cannot solve it by myself. Im using point_direction to allow mouse aim...
  19. David Lorenz

    GML Making moving object change sprites depending on direction

    Hello, everyone! I have a player object changing animated sprites depending on a "move_x" and a "move_y" variables, both set by pressing directional keys. Now I'm trying to make the player move automatically through a script, but even if the script works fine, I have no idea how to make the two...
  20. N

    Object slide on ice in x and y

    Hello! Newbie here. Top down game, object can move in X and Y, 360° "Step" is motion_set(image_angle+90, 1); and "key down" is image_angle+=3; So it always move forward and turn left when key press. I need to make object slide like on ice little forward of it previous direction while key down...
Top