Hi all,
I am new in monogame developer!
I need to create a simple animation that i send a click to my sprite so this scale to another size and stay in this size…and back to normal size when i click another time!
Can any one help me?
my acctualy code: http://pastebin.com/tb3QGqid
Add a scaled field to your Game class.
bool _scaled;
In Update
, check IsTouched()
, and toggle _scaled
if it returns true
.
if (IsTouched())
_scaled = !_scaled;
In Draw
, use the overload of SpriteBatch.Draw
that takes a scale parameter. If _scaled
is false
, use a scale of 1.0f, otherwise use a scale of 2.0f or whatever scale you want. Use the origin parameter to set the origin to the centre of the sprite (half sprite width and height) so it scales equally left/right and up/down. If the origin is set to the default top/left, the sprite will only scale to the right and down.