• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML change direction of instance_create

R

royer14

Guest
Hello again, as I am new the forum allows comment after 5 publications, so I thank them to those who help with my doubts, without more.

I have a Player object, Shooting object

In the player object I have added in the create event a script that does the actions that the player must do separately, with that I include the collision and some basic functions.

inside the player object I write this

Code:
dir_right =1;
it means that it starts at 1
event keyboard press <right>
add script

Code:
dir_right = 1
event keyboard press <left>
add script

Code:
dir_right = -1
Once I have created a variable, now I go to the player's script and I make an action when I press the spacebar key, the action of creating an instance of a trigger effect, not being screened in the same player script, I linked to another script:
player movement script
Code:
///move player and collision

/* I omit the rest of the code
*/
var shooter = keyboard_check(vk_space);
if (shooter)
    {
          shooting();
    }
create script shooting only to shoot.
Code:
if (dir_right =1)
    {
        particle_disp = instance_create(o_player.x+63,o_player.y +64,o_efx_shot); //o_efx_shot particle sprite 
        particle_disp.direction = 0;
        particle_disp.speed = 12 ;
    }
if (dir_right = -1)
    {
        particle_disp = instance_create(o_player.x-81,o_player.y+64,o_efx_shot);
        particle_disp.direction = 180;
        particle_disp.speed = 12 ;
        
    }
Now where can I change the orientation of the image, inside the o_efx_shot, or some other idea?
When I say orientation I refer to image_xscale
 
Top