I Wanna Community

Fangames => Game Design => Programming Questions => Topic started by: l3agu32 on February 21, 2016, 04:25:18 PM

Title: how to make the xscale from an object change to the xscale from the kid?
Post by: l3agu32 on February 21, 2016, 04:25:18 PM
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.
Title: Re: how to make the xscale from an object change to the xscale from the kid?
Post by: patrickgh3 on February 21, 2016, 05:51:29 PM
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.
Title: Re: how to make the xscale from an object change to the xscale from the kid?
Post by: L4Vo5 on March 12, 2016, 12:49:21 PM
How does it mess with the physics? i'm making a game (not using any engine) and this sounds kinda worrying.