invert sprite when walking
screen.clear()#ENTER
screen.setDrawScale(1,1) #ENTER
screen.drawMap("map",0,0,200) #ENTER
if checkInput(keyboard,"LEFT"):#ENTER
screen.setDrawScale(-1,1)#ENTER
if checkInput(keyboard,"RIGHT"):#ENTER
screen.setDrawScale(1,1) #ENTER
screen.drawSprite( sprite, x, y, 32 ))#ENTER
This should work fine, im not sure what this post is meant for. Is this to teach others?
If it like in some other engines and libraries and your sprite invert only once, when you press "LEFT", problem can be in that:
you set scale to -1 and sprite turn to left. But after that technically his scale still -1 ( or you can think like so - after pressing "LEFT"
program multiply his scale by (-1) ). And after that you set scale to 1 - or other words - multiply scale by 1. And of course, if his scale was
-1 ( or another ) it is still so.
If so, you can check sprite direction when pressing, and if it changes ( you can use variable for detect that ), you can multiply scale by (-1),
and do nothing or multiply by 1 if direction is the same as previously.
when typing code on a forum you might want to enclose it in triple back ticks (```) like this
print("hello world!")
make sure there's some above and below!
It worked for me, it's to help others😉
Thecoolestchip, It is like this because it is a variable called sprite but thanks for the help