W
William Turner
Guest
Something that has been bothering me for a while now is getting the players direction...honestly its bugging the hell out of me...
All I got for movement is this
as for why I need the direction...
I need the direction so that if the player turns then the hitbox will be created in the correct direction
ive tried a few things but nothings worked so far...
Any and all help is appreciated.
All I got for movement is this
Code:
//Movement
if keyboard_check(ord("D")){
sprite_index = s_player_right
x+=4
}
if keyboard_check(ord("A")){
sprite_index = s_player_left
x-=4
}
if keyboard_check(ord("S")){
sprite_index = s_player_down
y+=4
}
if keyboard_check(ord("W")){
sprite_index = s_player_up
y-=4
}
Code:
if keyboard_check_pressed(vk_space){
create_hitbox(s_hitbox_test,x,y,Direction??,300)
}
Code:
///@arg sprite
///@arg x
///@arg y
///@arg direction
///@arg life
var SPRITE = argument0
var X = argument1
var Y = argument2
var Direction = argument3
var Life = argument4
var HITBOX = instance_create_layer(X,Y,"Instances",obj_hitbox)
HITBOX.sprite_index = SPRITE
HITBOX.image_angle = Direction
HITBOX.alarm[0] = Life
return HITBOX
Any and all help is appreciated.
Last edited by a moderator: