Skip to content

Commit

Permalink
Update snakegame.py
Browse files Browse the repository at this point in the history
Fixing: 
TypeError: Your handler State.turnOnTick must only return/yield: None, Events or other EventHandlers referenced by their class (not using `self`)
  • Loading branch information
abulvenz authored Sep 4, 2023
1 parent fd5e7fa commit dbc1e3b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions snakegame/snakegame/snakegame.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ def turnOnTick(self):
if self.start:
#print(self.snake)
#print(self.food)
return self.tick
return State.tick

def turnOffTick(self):
self.start = False
if self.start:
return self.tick
return State.tick
def flip_switch(self, start):
self.start = start
if self.start:
return self.tick
return State.tick

async def tick(self):
if self.start:
Expand Down Expand Up @@ -64,7 +64,7 @@ async def tick(self):
self.food = [5,5]
self.dir = HEAD_R
await asyncio.sleep(3)
return self.tick
return State.tick

self.cells[head[0]+ N*head[1]] = COLOR_BODY
self.snake.append(head.copy())
Expand All @@ -84,7 +84,7 @@ async def tick(self):
self.tick_cnt += 1
#print(self.tick_cnt)

return self.tick
return State.tick

def arrow_up(self):
if(self.dir != HEAD_D):
Expand Down Expand Up @@ -173,4 +173,4 @@ def index():
app = rx.App(state=State)
app.add_page(index, title="snake game")

app.compile()
app.compile()

0 comments on commit dbc1e3b

Please sign in to comment.