Re: I want to lirn pithon but pithon doesn't want me to do so
ok so, i'm making something where if the player walk near a tree it will blo up its self, I coded the walking cystom now but something's rong here, if I press any arrow to walk it exits with out in error, the code is here
from random import randint
from random import randrange
import timer
from speech import speak
import lucia
lucia.initialize()
p=lucia.audio_backend.SoundPool()
walktimer=timer.timer
class player:
def __init__(self,x=0,y=0,z=0):
self.x=x
self.y=y
self.z=z
class tree:
def __init__(self,x=randint(0,30),y=randint(0,30)):
self.x=treex
self.y=treey
p.play_2d("treeloop.ogg",me.x,me.y,treex,treey,true)
def main():
lucia.show_window("treecrasher")
me=player()
while True:
lucia.process_events()
if me.x<0:
me.x==0
if me.y<0:
me.y==0
if me.x>30:
me.x==30
if me.y>30:
me.y==30
if lucia.key_down(lucia.K_UP) and walktimer.elapsed>=500:
walktimer.restart()
me.y+=1
elif lucia.key_down(lucia.K_DOWN) and walktimer.elapsed>=500:
walktime.restart()
me.y-=1
elif lucia.key_down(lucia.K_LEFT) and walktime.elapsed>=500:
walktime.restart()
me.x-=1
elif lucia.key_down(lucia.K_RIGHT) and walktime.elapsed>500:
walktime.restart()
me.x+=1
elif lucia.key_pressed(lucia.K_ESCAPE):
lucia.quit()
main()
-- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector