GameMaker: Studio

GameMaker: Studio

View Stats:
Zonic405 May 27, 2017 @ 2:13pm
I need help with this code....
so whenever i press the space key the red box is diagnol from my player... i need help

/// melee attack

if (keyboard_check_pressed(vk_space))
{
var xdiff = x - xprevious;
var ydiff = y - yprevious;

if (!(xdiff == 0 && ydiff == 0))
{
deltax = xdiff;
deltay = ydiff;
}

instance_create(x + sign(deltax) * 32, y + sign(deltay) * 32, objhitbox)
}
if (sprite_index == sprite0)
deltay = 1;
if (sprite_index == sprite2)
deltax = 1;
if (sprite_index == sprite4)
deltax =- 1;
if (sprite_index == sprite6)
deltay =- 1;

oh and this was from a tutorial with some improve
Date Posted: May 27, 2017 @ 2:13pm
Posts: 0