Fangames > Programming Questions
how to make the xscale from an object change to the xscale from the kid?
(1/1)
l3agu32:
I attached an object to the kid and I want to make this objects' xscale change always that the kid's xscale changes.
I put the codes in the step event of the object. The kid's object is named objPlayer.
The first code I tried was this one: image_xscale=objPlayer.image_xscale
The other code I tried was: if objPlayer.image_xscale=-1{image_xscale=-1}else{image_xscale=1}
I really don't know if the dots are needed or if the code has to be in the step event. I would appreciate some help, thank you.
patrickgh3:
Your code would work in the 8.1 engines, but not the studio engines, which I assume you're using. For some reason changing the player's image_xscale in studio messes up the physics. So instead, the engines store that xscale variable somewhere else, and manually draw the player with that xscale. In Yoyo's engine the variable is "player.xScale", and in previous versions it was "global.player_xscale". So yeah, your first attempt is the right idea, just use the player's special xscale variable instead.
L4Vo5:
How does it mess with the physics? i'm making a game (not using any engine) and this sounds kinda worrying.
Navigation
[0] Message Index
Go to full version