Hello!
I am currently working on a simple life-like simulation game, and I have run into some issues with the code when I am trying to move the player to different sectors of the display
this is the code that I am working on:
import thumby
import time
thumby.display.setFPS(20)
treemap = bytearray([6,9,57,9,6])
tree = thumby.Sprite(5, 6, treemap)
tree2 = thumby.Sprite(5, 6, treemap)
playermap = bytearray([10,7,10])
prsn = thumby.Sprite(3, 4, playermap)
prsn.x = 29
prsn.y = 15
sect = 1
maxup = 0
maxdown = 0
while(True):
thumby.display.fill(0)
if sect = 1 and prsn.x < thumby.display.width - 2:
sect = 2
prsn.x = 0
if sect = 1 and prsn.y < thumby.display.height - 3:
sect = 3
prsn.y = 0
if sect = 2 and prsn.x < 2:
sect = 1
prsn.x = 0
if sect = 2 and prsn.y < 3:
sect = 4
prsn.y = 0
if sect = 3 and prsn.x < thumby.display.width - 2:
sect = 4
prsn.x = 0
if sect = 3 and prsn.y < 2:
sect = 1
prsn.y = 0
if sect = 1:
tree2.y = 55
tree2.y = 25
tree.x = 10
tree.y = 10
if sect = 2:
tree2.y = 20
tree2.y = 10
tree.x = 40
tree.y = 20
if sect = 3:
tree2.y = 20
tree2.y = 10
tree.x = 40
tree.y = 20
if sect = 4:
tree2.y = 55
tree2.y = 25
tree.x = 10
tree.y = 10
if thumby.buttonU.pressed():
prsn.y -= 1
if thumby.buttonD.pressed():
prsn.y += 1
if thumby.buttonL.pressed():
prsn.x -= 1
if thumby.buttonR.pressed():
prsn.x += 1
thumby.display.drawSprite(tree)
thumby.display.drawSprite(prsn)
thumby.display.update()
The problem is with the if/ and statements (the shell says line 16), they somehow have a syntax error which I cannot seem to recognize.
if there is anyone willing to help, that would be great!
Thanks