Discord
Login
Community
DARK THEME

How to use variables to define sprites?

I want to be able to have a variable that can change to be the name of the player sprite, but I don't know how to? I've tried doing screen.drawSprite(player,0,0,50,50) where player is the name of the variable but it wouldn't work? (I joined a couple of days ago so if there is some really obvious solution in the documents that I didn't see please tell me!)

You have to assign the name of your sprite as a string to a variable.

Like: mySprite = "player"

Then you use the variable in your draw call.
screen.drawSprite(mySprite,...

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community