L
Luka Radulovic
Guest
I have this line that should change the xscale of the object:
When I use it, nothing happens. So after shifting the location of the code in Step, everything remained the same.
Eventually I just wanted to try out how image_xscale works so I put in this line:
The object remains its sprite from the Sprites folder. Nothing still changed.
Here's the full script of the object below.
Create Event:
Step Event:
Draw Step:
Last pieces of information: The variables are set in the Variable Definitions section of the object. Its parent is oWall that is an object which does nothing, besides stop play from moving into it.
GML:
if (hsp != 0) image_xscale = sign(hsp);
Eventually I just wanted to try out how image_xscale works so I put in this line:
Code:
image_xscale = -1;
Here's the full script of the object below.
Create Event:
Code:
sprite_index = -1;
Code:
mask_index = sHorizontalFloater;
hspd = dir * movespeed;
//counting until direction change
// float for 100 frames
if (amount_floated >= total_flying) {
dir *= -1;
amount_floated = 0;
}
amount_floated++;
x += hspd;
//masks, and hsp_carry
if (instance_exists(oPlayer)) {
if (round(oPlayer.y + (oPlayer.sprite_height/2)) > y) || (oPlayer.key_down) {
mask_index = -1;
} else {
mask_index = sHorizontalFloater;
if (place_meeting(x, y-1, oPlayer)) oPlayer.hsp_carry = hspd;
}
}
//animation
// Changing the direction of sprite
if (hspd != 0) image_xscale = sign(hspd);
Code:
draw_sprite(sHorizontalFloater, 0, x, y);
Last edited by a moderator: