Discord
Login
Community
DARK THEME

how do i make the arrows change the player sprite? and yes this is all the code

init = function() play = "play" play1 = sprites["play"] leftarrow = sprites["leftarrow"] rightarrow = sprites["rightarrow"] homepage = true playergui = false arrownume = 1 arrownum = "1" skins = 1 end

update = function() if homepage == true then if mouse.x >= 0-play1.width/2 and mouse.x <= play1.width/2 and mouse.y >= 0-play1.height/2 and mouse.y <= play1.height/2 then if mouse.pressed then screen.drawSprite("play2",0,0,100,100) sleep(200) homepage = false playergui=true end end end if mouse.x >= 0-leftarrow.width/2 and mouse.x <= leftarrow.width/2 and mouse.y>= 0-leftarrow.height/2 and mouse.y <= leftarrow.height/2 then if mouse.pressed and 0-skins= 0-rightarrow.width/2 and mouse.x <= rightarrow.width/2 and mouse.y>= 0-rightarrow.height/2 and mouse.y <= rightarrow.height/2 then if mouse.pressed and skins>arrownume then arrownume += 1 end end arrownum = arrownume.toString() end

draw = function() screen.clear("rgb(160,87,197)") if homepage == true then screen.drawSprite(play,0,0,100,100) end if playergui == true then screen.fillRoundRect(90,0,200,200,30,"rgb(197,138,22)") screen.drawSprite("leftarrow",20,-20,100,100) screen.drawSprite("rightarrow",153,-21,100,100) screen.drawSprite("player"+arrownum,113,0,200,200) end end

i used a variable that changed depending on the arrow pressed last to determine if he was walking, idling, or in the air. and then i made the s ript that drew it something like If state==walk then screen.drawSprite("player_walk",x,y,size). hope that helped

To post clearly formatted code on the forum, use triple backticks (```) above and below your code.

Before the code block
```
print("hello world")
```
After the code block

Result:

Before the code block

print("hello world")

After the code block

ty

Post a reply

Progress

Status

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