Skip to main content
Code Review

Return to Question

Bumped by Community user
Bumped by Community user
Bumped by Community user
Notice removed Draw attention by Community Bot
Bounty Ended with no winning answer by Community Bot
Tweeted twitter.com/StackCodeReview/status/1055836632929222657
Notice added Draw attention by Offtkp
Bounty Started worth 50 reputation by Offtkp
edited tags
Link
200_success
  • 145.5k
  • 22
  • 190
  • 478
added 670 characters in body
Source Link
Offtkp
  • 371
  • 2
  • 11

Here's a pic. Notice how there is image burn from the last frame? There is only one pillar, and only one frame of the player, but two appear. Is this fixable, or is it because of the screen only?

Image burn and ghosting


Here's a pic. Notice how there is image burn from the last frame? There is only one pillar, and only one frame of the player, but two appear. Is this fixable, or is it because of the screen only?

Image burn and ghosting

added 670 characters in body
Source Link
Offtkp
  • 371
  • 2
  • 11
tam1a = tam1.split('\n')
tam2a = tam2.split('\n')
tam3a = tam3.split('\n')
 #jump variables 
 dist = 0
 gup = False
#jump variables 
dist = 0 #distance off the ground
gup = False #isjumping
#obstacle variables
xx = 0 #x position of the obstacle that loops through the screen
#other variables
score = 0;
ind = 0; #current frame of player, there is 3
extraspeed = 0; #makes the pillar go faster as your score rises
while True: #gameloop start
 draw.rectangle((0,0,LCD.LCDWIDTH,LCD.LCDHEIGHT), outline=255, fill=255)
 #clear#clears imagethe screen --^
 draw.text((0,0),str(score),font=font) #draw score
 extraspeed = floor(score / 100) #set extraspeed based on score
 if extraspeed > 10:
 extraspeed = 10
 score += 3
 draw.rectangle((xx,32,xx+3,42),outline=0,fill=0)
 xx = xx + 4 +extraspeed #move the pillar
 if xx >= 84:
 xx = -4;
 if key == ' ':
 if dist == 0:
 gup = True
 key = "lol" #if dist = 0 means its on the ground
  #the "lol" thing is something I left over for some reason, it means no key pressed
 else:
 key = "lol"
 if gup == True:
 if dist != 12: #jumps up to 12 pixels off the ground
 dist += 3
 else:
 gup = False #start falling if reached top
 else:
 if dist > 0:
 dist -= 3
 else:
 dist = 0
 #ind is the current animation sprite to draw
 if ind == 1:
 i = 12-dist #top left corner of drawn sprite y
 j = 60 #top left corner of drawn sprite x
 for line in tam1a:
 for c in line:
 if c == '1':
 draw.point((j,i),fill=0)
 j+=1
 i+=1
 j=60 #make same as j at start
 if ind == 2:
 i = 12-dist #top left corner of drawn sprite y
 j = 60 #top left corner of drawn sprite x
 for line in tam2a:
 for c in line:
 if c == '1':
 draw.point((j,i),fill=0)
 j+=1
 i+=1
 j=60 #make same as j at start
 if ind == 3:
 i = 12-dist #top left corner of drawn sprite y
 j = 60 #top left corner of drawn sprite x
 for line in tam3a:
 for c in line:
 if c == '1':
 draw.point((j,i),fill=0)
 j+=1
 i+=1
 j=60 #make same as j at start
 
 ind += 1
 if ind == 4:
 ind = 1 #restart the animation
 draw.line((0,43,83,43),fill=0)
 draw.line((0,44,83,44),fill=0) #draw some ground
 # if xx >= float(67) and xx<= float(80) and dist <= 7:
 # break #Some simple collision detection
# Display image.
 disp.image(image) #draw everything
 disp.display() #display everything
 time.sleep(0.2) #5 frames per second
draw.text((40,10),'Hit',font=font) #got here if 'break' occurs
disp.image(image) #displays hit, which means game over and loop is broken
disp.display()
tam1a = tam1.split('\n')
tam2a = tam2.split('\n')
tam3a = tam3.split('\n')
 #jump variables 
 dist = 0
 gup = False
#obstacle variables
xx = 0
#other variables
score = 0;
ind = 0;
extraspeed = 0;
while True:
 draw.rectangle((0,0,LCD.LCDWIDTH,LCD.LCDHEIGHT), outline=255, fill=255)
 #clear image
 draw.text((0,0),str(score),font=font)
 extraspeed = floor(score / 100)
 if extraspeed > 10:
 extraspeed = 10
 score += 3
 draw.rectangle((xx,32,xx+3,42),outline=0,fill=0)
 xx = xx + 4 +extraspeed
 if xx >= 84:
 xx = -4;
 if key == ' ':
 if dist == 0:
 gup = True
 key = "lol"
 else:
 key = "lol"
 if gup == True:
 if dist != 12:
 dist += 3
 else:
 gup = False
 else:
 if dist > 0:
 dist -= 3
 else:
 dist = 0
 #ind is the current animation sprite to draw
 if ind == 1:
 i = 12-dist #top left corner of drawn sprite y
 j = 60 #top left corner of drawn sprite x
 for line in tam1a:
 for c in line:
 if c == '1':
 draw.point((j,i),fill=0)
 j+=1
 i+=1
 j=60 #make same as j at start
 if ind == 2:
 i = 12-dist #top left corner of drawn sprite y
 j = 60 #top left corner of drawn sprite x
 for line in tam2a:
 for c in line:
 if c == '1':
 draw.point((j,i),fill=0)
 j+=1
 i+=1
 j=60 #make same as j at start
 if ind == 3:
 i = 12-dist #top left corner of drawn sprite y
 j = 60 #top left corner of drawn sprite x
 for line in tam3a:
 for c in line:
 if c == '1':
 draw.point((j,i),fill=0)
 j+=1
 i+=1
 j=60 #make same as j at start
 
 ind += 1
 if ind == 4:
 ind = 1
 draw.line((0,43,83,43),fill=0)
 draw.line((0,44,83,44),fill=0)
 # if xx >= float(67) and xx<= float(80) and dist <= 7:
 # break
# Display image.
 disp.image(image)
 disp.display()
 time.sleep(0.2)
draw.text((40,10),'Hit',font=font)
disp.image(image)
disp.display()
tam1a = tam1.split('\n')
tam2a = tam2.split('\n')
tam3a = tam3.split('\n')
#jump variables 
dist = 0 #distance off the ground
gup = False #isjumping
#obstacle variables
xx = 0 #x position of the obstacle that loops through the screen
#other variables
score = 0;
ind = 0; #current frame of player, there is 3
extraspeed = 0; #makes the pillar go faster as your score rises
while True: #gameloop start
 draw.rectangle((0,0,LCD.LCDWIDTH,LCD.LCDHEIGHT), outline=255, fill=255)
 #clears the screen --^
 draw.text((0,0),str(score),font=font) #draw score
 extraspeed = floor(score / 100) #set extraspeed based on score
 if extraspeed > 10:
 extraspeed = 10
 score += 3
 draw.rectangle((xx,32,xx+3,42),outline=0,fill=0)
 xx = xx + 4 +extraspeed #move the pillar
 if xx >= 84:
 xx = -4;
 if key == ' ':
 if dist == 0:
 gup = True
 key = "lol" #if dist = 0 means its on the ground
  #the "lol" thing is something I left over for some reason, it means no key pressed
 else:
 key = "lol"
 if gup == True:
 if dist != 12: #jumps up to 12 pixels off the ground
 dist += 3
 else:
 gup = False #start falling if reached top
 else:
 if dist > 0:
 dist -= 3
 else:
 dist = 0
 #ind is the current animation sprite to draw
 if ind == 1:
 i = 12-dist #top left corner of drawn sprite y
 j = 60 #top left corner of drawn sprite x
 for line in tam1a:
 for c in line:
 if c == '1':
 draw.point((j,i),fill=0)
 j+=1
 i+=1
 j=60 #make same as j at start
 if ind == 2:
 i = 12-dist #top left corner of drawn sprite y
 j = 60 #top left corner of drawn sprite x
 for line in tam2a:
 for c in line:
 if c == '1':
 draw.point((j,i),fill=0)
 j+=1
 i+=1
 j=60 #make same as j at start
 if ind == 3:
 i = 12-dist #top left corner of drawn sprite y
 j = 60 #top left corner of drawn sprite x
 for line in tam3a:
 for c in line:
 if c == '1':
 draw.point((j,i),fill=0)
 j+=1
 i+=1
 j=60 #make same as j at start
 
 ind += 1
 if ind == 4:
 ind = 1 #restart the animation
 draw.line((0,43,83,43),fill=0)
 draw.line((0,44,83,44),fill=0) #draw some ground
 if xx >= float(67) and xx<= float(80) and dist <= 7:
 break #Some simple collision detection
# Display image.
 disp.image(image) #draw everything
 disp.display() #display everything
 time.sleep(0.2) #5 frames per second
draw.text((40,10),'Hit',font=font) #got here if 'break' occurs
disp.image(image) #displays hit, which means game over and loop is broken
disp.display()
Source Link
Offtkp
  • 371
  • 2
  • 11
Loading
lang-py

AltStyle によって変換されたページ (->オリジナル) /