python - Why is it disregarding the code? -
i trying make "animation" start of game, code goes on starting feel unresponsive change make. instance, if make ml = 99999999 instead of starting on @ ml = 1, still reset animation. makes no sense me. please , in advance.
elif v == 4: if event.type == event_250ms: if ml == 1: d.fill(mexon) x_coord = 0 y_coord = 0 direction = 'up' b(llcn1, (40, 140)) b(llcs1, (400, 240)) ml = 2 elif ml == 2: d.fill(mexon) x_coord = 0 y_coord = 0 direction = 'up' b(llcn2, (41, 140)) b(llcs2, (399, 240)) ml = 3 elif ml == 3: d.fill(mexon) x_coord = 0 y_coord = 0 direction = 'up' b(llcn3, (42, 140)) b(llcs3, (398, 240)) ml = 4 elif ml == 4: d.fill(mexon) x_coord = 0 y_coord = 0 direction = 'up' b(llcn4, (43, 140)) b(llcs4, (397, 240)) ml = 5 elif ml == 5: d.fill(mexon) x_coord = 0 y_coord = 0 direction = 'up' b(llcn5, (44, 140)) b(llcs5, (396, 240)) ml = 6 elif ml == 6: d.fill(mexon) x_coord = 0 y_coord = 0 direction = 'up' b(llcn6, (45, 140)) b(llcs6, (395, 240)) ml = 7 elif ml == 7: d.fill(mexon) x_coord = 0 y_coord = 0 direction = 'up' b(llcn7, (46, 140)) b(llcs7, (394, 240)) ml = 1 elif ml == 8: d.fill(mexon) x_coord = 0 y_coord = 0 direction = 'up' b(llcn8, (47, 140)) b(llcs8, (393, 240)) ml = 9 elif ml == 9: d.fill(mexon) x_coord = 0 y_coord = 0 direction = 'up' b(llcn9, (48, 140)) b(llcs9, (392, 240)) ml = 10 elif ml == 10: d.fill(mexon) x_coord = 0 y_coord = 0 direction = 'up' b(llcn10, (49, 140)) b(llcs10, (391, 240)) ml = 11 elif ml == 11: d.fill(mexon) x_coord = 0 y_coord = 0 direction = 'up' b(llcn11, (50, 140)) b(llcs11, (390, 240)) ml = 12 elif ml == 12: d.fill(mexon) x_coord = 0 y_coord = 0 direction = 'up' b(llcn12, (51, 140)) b(llcs12, (389, 240)) ml = 1 this code animation in question. next part declare of statements , such.
import pygame, sys, random pygame.locals import * pygame.init() black = ( 0, 0, 0) pindler = (255, 123, 90) mexon = (200, 180, 220) white = (255, 255, 255) yellow = (255, 255, 0) red = (255, 0, 0) blue = ( 0, 0, 255) size = [700, 500] d = pygame.display.set_mode(size) l = pygame.draw.aaline r = pygame.draw.rect g = random.randrange(1, 10) gm = 1 gmt = 2 cip = 1 sh = 0 aac = 2 chbp = 0 sthb = 1 cc = 0 cm = 1 pl = pygame.draw.line pe = pygame.draw.ellipse gmft = 0 htt = 0 co = 2 v = 5 ml = 1 pfo = 0 cl = 0 blue = 1 red = 1 level = 1 event_250ms = pygame.userevent + 1 pygame.time.set_timer(event_250ms, 250) pygame.display.set_caption("moline") myfont1 = pygame.font.sysfont("monospace", 40) myfont2 = pygame.font.sysfont("monospace", 60) myfont3 = pygame.font.sysfont("monospace", 20) myfont4 = pygame.font.sysfont("monospace", 100) t1 = myfont1.render t2 = myfont2.render t3 = myfont3.render t4 = myfont4.render mol = "moline" m1s = "directions:" m2s = "1. use arrow keys control 4 characters" m2f = " off of track move them." m3s = "2. win level, line 4 characters on" m3f = " crossmark before runner on track" m3c = " reaches finish line." m4s = "3. if runner reaches finish line, then" m4f = " lose." m5s = "4. when lose go level one. there" m5f = " 8 levels." m6s = "5. key input makes runner move slightly" m6f = " faster, move without input." m6c = " additionally, mouse movement makes him faster." m7s = "6. should noted whenever click to" m7f = " start, game begin have" m7c = " arrow keys ready go." isc = "left-click start game" lest = "level: " lu1 = "1" lu2 = "2" lu3 = "3" lu4 = "4" lu5 = "5" lu6 = "6" lu7 = "7" lu8 = "8" vtc2 = "left-click begin next level" vtc3 = "left-click start over" vtc1 = "left-click start over" vt3 = "you win!!!" vt2 = "level complete" vt1 = "game over" lcn = "titancorp" lcs = "studios" lcp = "presents" llcs1 = t2(lcs, 1, (200, 180, 220)) llcs2 = t2(lcs, 1, (205, 187, 200)) llcs3 = t2(lcs, 1, (210, 194, 180)) llcs4 = t2(lcs, 1, (215, 201, 160)) llcs5 = t2(lcs, 1, (220, 208, 140)) llcs6 = t2(lcs, 1, (225, 215, 120)) llcs7 = t2(lcs, 1, (230, 222, 100)) llcs8 = t2(lcs, 1, (235, 229, 80)) llcs9 = t2(lcs, 1, (240, 236, 60)) llcs10 = t2(lcs, 1, (245, 243, 40)) llcs11 = t2(lcs, 1, (250, 250, 20)) llcs12 = t2(lcs, 1, (255, 255, 0)) llcn1 = t2(lcn, 1, (200, 180, 220)) llcn2 = t2(lcn, 1, (205, 187, 200)) llcn3 = t2(lcn, 1, (210, 194, 180)) llcn4 = t2(lcn, 1, (215, 201, 160)) llcn5 = t2(lcn, 1, (220, 208, 140)) llcn6 = t2(lcn, 1, (225, 215, 120)) llcn7 = t2(lcn, 1, (230, 222, 100)) llcn8 = t2(lcn, 1, (235, 229, 80)) llcn9 = t2(lcn, 1, (240, 236, 60)) llcn10 = t2(lcn, 1, (245, 243, 40)) llcn11 = t2(lcn, 1, (250, 250, 20)) llcn12 = t2(lcn, 1, (255, 255, 0)) #moline text goes @ (170, 70) llcn10000 = t4(mol, 1, (255, 255, 0)) llcn2000 = t4(mol, 1, (235, 235, 50)) llcn30000 = t4(mol, 1, (225, 220, 100)) llcn4000 = t4(mol, 1, (215, 205, 200)) llcn50000 = t4(mol, 1, (200, 180, 220)) l1 = t3(m1s, 1, (255, 255, 0)) l2 = t3(m2s, 1, (255, 255, 0)) l2c = t3(m2f, 1, (255, 255, 0)) l3 = t3(m3s, 1, (255, 255, 0)) l3c = t3(m3f, 1, (255, 255, 0)) l3f = t3(m3c, 1, (255, 255, 0)) l4 = t3(m4s, 1, (255, 255, 0)) l4c = t3(m4f, 1, (255, 255, 0)) l5 = t3(m5s, 1, (255, 255, 0)) l5c = t3 (m5f, 1, (255, 255, 0)) l6 = t3(m6s, 1, (255, 255, 0)) l6c = t3(m6f, 1, (255, 255, 0)) l6f = t3(m6c, 1, (255, 255, 0)) l7 = t3(m7s, 1, (255, 255, 0)) l7c = t3(m7f, 1, (255, 255, 0)) l7f = t3(m7c, 1, (255, 255, 0)) sfgl = t1(isc, 1, (255, 255, 0)) les = t3(lest, 1, (255, 255, 0)) las1 = t3(lu1, 1, (255, 255, 0)) las2 = t3(lu2, 1, (255, 255, 0)) las3 = t3(lu3, 1, (255, 255, 0)) las4 = t3(lu4, 1, (255, 255, 0)) las5 = t3(lu5, 1, (255, 255, 0)) las6 = t3(lu6, 1, (255, 255, 0)) las7 = t3(lu7, 1, (255, 255, 0)) las8 = t3(lu8, 1, (255, 255, 0)) v3cb = t3(vtc3, 1, (255, 255, 0)) v3cy = t3(vtc3, 1, ( 0, 0, 255)) v2cb = t3(vtc2, 1, (255, 255, 0)) v2cy = t3(vtc2, 1, ( 0, 0, 255)) v1cb = t3(vtc1, 1, ( 0, 0, 0)) v1cr = t3(vtc1, 1, (255, 0, 0)) v3b = t2(vt3, 1, (255, 255, 0)) v3y = t2(vt3, 1, ( 0, 0, 0)) v2b = t2(vt2, 1, (255, 255, 0)) v2y = t2(vt2, 1, ( 0, 0, 255)) v1r = t2(vt1, 1, ( 0, 0, 0)) v1b = t2(vt1, 1, (255, 0, 0)) b = d.blit fx = 10 fy = 10
are asking why running program not reflect change make after started running? won't work way, python loads entire script @ compile time. never looks changes afterwards.
Comments
Post a Comment