Compare commits
No commits in common. "main" and "1.1.0" have entirely different histories.
2 changed files with 40 additions and 38 deletions
|
@ -2,6 +2,4 @@
|
|||
A simple game using Pygame library (version 2.1 or later is required to avoid camera issues).
|
||||
You control a spaceship moving computer mouse (or any other input device that can emulate it like touchpads, joysticks or trackballs)
|
||||
|
||||
"Source" and "level maps" folders are not required to play the game, only "backgounds", "music", "sfx", "sprites" and "r3.py" executable
|
||||
|
||||
I'm not longer working on this project, it is being ported to Godot Game Engine
|
||||
"Source" and "level maps" folders are not required to play the game, only "backgounds", "music", "sfx", "sprites" and "r3.py" executable
|
74
r3.py
74
r3.py
|
@ -7,7 +7,7 @@ import platform
|
|||
import subprocess
|
||||
pygame.init()
|
||||
screen = pygame.display.set_mode((800, 480))
|
||||
pygame.display.set_caption('The Red Robot Radio 1.1.1 - Virtualx Game Engine')
|
||||
pygame.display.set_caption('The Red Robot Radio 1.1.0 - Virtualx Game Engine')
|
||||
font = pygame.font.Font(None, 30)
|
||||
clock = pygame.time.Clock()
|
||||
crashbg = 'backgrounds/crash.png'
|
||||
|
@ -281,11 +281,8 @@ else:
|
|||
if music:
|
||||
pygame.mixer.music.play(-1)
|
||||
running = True
|
||||
rstate = 0
|
||||
# 0 for title screen
|
||||
# 1 for live spaceship
|
||||
# 2 for crashed spaceship
|
||||
# 3 for completed
|
||||
live = True
|
||||
complete = False
|
||||
debug = False # This set debug mode
|
||||
pygame.mouse.set_visible(False)
|
||||
#rect = pygame.Rect((0, 0), (32, 32))
|
||||
|
@ -310,7 +307,6 @@ while running:
|
|||
if debug:
|
||||
#this trigger spaceship crash event
|
||||
live = False
|
||||
rstate = 2
|
||||
pygame.mixer.music.stop()
|
||||
background = Background('backgrounds/crash.png')
|
||||
csfx.play()
|
||||
|
@ -374,7 +370,6 @@ while running:
|
|||
pygame.mixer.music.play(-1)
|
||||
live = True
|
||||
complete = False
|
||||
rstate = 1
|
||||
if music:
|
||||
pygame.mixer.music.play(-1)
|
||||
start_time = pygame.time.get_ticks()
|
||||
|
@ -394,96 +389,97 @@ while running:
|
|||
ey = ay * 1
|
||||
|
||||
|
||||
if (rstate == 1):
|
||||
if live:
|
||||
runtime = pygame.time.get_ticks() - start_time
|
||||
if (debug == False):
|
||||
if (live & debug == False):
|
||||
if pygame.sprite.collide_rect(player, wall3):
|
||||
rstate = 2
|
||||
live = False
|
||||
pygame.mixer.music.stop()
|
||||
background = Background(crashbg)
|
||||
csfx.play()
|
||||
elif pygame.sprite.collide_rect(player, wall4):
|
||||
rstate = 2
|
||||
live = False
|
||||
pygame.mixer.music.stop()
|
||||
background = Background(crashbg)
|
||||
csfx.play()
|
||||
elif pygame.sprite.collide_rect(player, wall1):
|
||||
rstate = 2
|
||||
live = False
|
||||
pygame.mixer.music.stop()
|
||||
background = Background(crashbg)
|
||||
csfx.play()
|
||||
elif pygame.sprite.collide_rect(player, wall2):
|
||||
rstate = 2
|
||||
live = False
|
||||
pygame.mixer.music.stop()
|
||||
background = Background(crashbg)
|
||||
csfx.play()
|
||||
elif pygame.sprite.collide_rect(player, css1):
|
||||
rstate = 2
|
||||
live = False
|
||||
pygame.mixer.music.stop()
|
||||
background = Background(crashbg)
|
||||
csfx.play()
|
||||
elif pygame.sprite.collide_rect(player, css2):
|
||||
rstate = 2
|
||||
live = False
|
||||
pygame.mixer.music.stop()
|
||||
background = Background(crashbg)
|
||||
csfx.play()
|
||||
elif pygame.sprite.collide_rect(player, css3):
|
||||
rstate = 2
|
||||
live = False
|
||||
pygame.mixer.music.stop()
|
||||
background = Background(crashbg)
|
||||
csfx.play()
|
||||
elif pygame.sprite.collide_rect(player, sat1):
|
||||
rstate = 2
|
||||
live = False
|
||||
pygame.mixer.music.stop()
|
||||
background = Background(crashbg)
|
||||
csfx.play()
|
||||
elif pygame.sprite.collide_rect(player, sat2):
|
||||
rstate = 2
|
||||
live = False
|
||||
pygame.mixer.music.stop()
|
||||
background = Background(crashbg)
|
||||
csfx.play()
|
||||
elif pygame.sprite.collide_rect(player, sat3):
|
||||
rstate = 2
|
||||
live = False
|
||||
pygame.mixer.music.stop()
|
||||
background = Background(crashbg)
|
||||
csfx.play()
|
||||
elif pygame.sprite.collide_rect(player, bus1):
|
||||
rstate = 2
|
||||
live = False
|
||||
pygame.mixer.music.stop()
|
||||
background = Background(crashbg)
|
||||
csfx.play()
|
||||
elif pygame.sprite.collide_rect(player, bus2):
|
||||
rstate = 2
|
||||
live = False
|
||||
pygame.mixer.music.stop()
|
||||
background = Background(crashbg)
|
||||
csfx.play()
|
||||
elif pygame.sprite.collide_rect(player, tc1):
|
||||
rstate = 2
|
||||
live = False
|
||||
pygame.mixer.music.stop()
|
||||
background = Background(crashbg)
|
||||
csfx.play()
|
||||
elif pygame.sprite.collide_rect(player, tc2):
|
||||
rstate = 2
|
||||
live = False
|
||||
pygame.mixer.music.stop()
|
||||
background = Background(crashbg)
|
||||
csfx.play()
|
||||
elif pygame.sprite.collide_rect(player, iss1):
|
||||
rstate = 2
|
||||
live = False
|
||||
pygame.mixer.music.stop()
|
||||
background = Background(crashbg)
|
||||
csfx.play()
|
||||
elif pygame.sprite.collide_rect(player, iss2):
|
||||
rstate = 2
|
||||
live = False
|
||||
pygame.mixer.music.stop()
|
||||
background = Background(crashbg)
|
||||
csfx.play()
|
||||
elif pygame.sprite.collide_rect(player, iss3):
|
||||
rstate = 2
|
||||
live = False
|
||||
pygame.mixer.music.stop()
|
||||
background = Background(crashbg)
|
||||
csfx.play()
|
||||
elif pygame.sprite.collide_rect(player, goal):
|
||||
rstate = 3
|
||||
live = False
|
||||
complete = True
|
||||
pygame.mixer.music.stop()
|
||||
background = Background('backgrounds/antenna.png')
|
||||
lcfx.play()
|
||||
|
@ -513,7 +509,7 @@ while running:
|
|||
wall4.update()
|
||||
background.update()
|
||||
screen.blit(background.image, background.rect)
|
||||
if (rstate == 1):
|
||||
if live:
|
||||
#screen.blit(background.image, background.rect)
|
||||
screen.blit(ast3.image, ast3.rect)
|
||||
screen.blit(ast2.image, ast2.rect)
|
||||
|
@ -539,28 +535,36 @@ while running:
|
|||
screen.blit(wall2.image, wall2.rect)
|
||||
screen.blit(wall3.image, wall3.rect)
|
||||
screen.blit(wall4.image, wall4.rect)
|
||||
elif (rstate == 0):
|
||||
yourtimetext = font.render(str("Move computer mouse and press R to start playing"), True, pygame.Color('white'))
|
||||
screen.blit(yourtimetext, (150, 400))
|
||||
elif complete:
|
||||
playhr = (int(runtime / 3600000))
|
||||
playmin = (int(runtime / 60000) - (playhr * 60))
|
||||
playsec = (int(runtime / 1000) - (playmin * 60) - (playhr * 3600))
|
||||
playmsec = (runtime - (playsec * 1000) - (playmin * 60000) - (playhr * 3600000))
|
||||
playtime = "%d:%02d:%02d:%03d" % (playhr, playmin, playsec, playmsec)
|
||||
#screen.blit(antenna.image, antenna.rect)
|
||||
yourtimetext = font.render(str("Your Time"), True, pygame.Color('white'))
|
||||
screen.blit(yourtimetext, (350, 400))
|
||||
yourtime = font.render(str(playtime), True, pygame.Color('white'))
|
||||
screen.blit(yourtime, (350, 440))
|
||||
else:
|
||||
playhr = (int(runtime / 3600000))
|
||||
playmin = (int(runtime / 60000) - (playhr * 60))
|
||||
playsec = (int(runtime / 1000) - (playmin * 60) - (playhr * 3600))
|
||||
playmsec = (runtime - (playsec * 1000) - (playmin * 60000) - (playhr * 3600000))
|
||||
playtime = "%d:%02d:%02d:%03d" % (playhr, playmin, playsec, playmsec)
|
||||
#screen.blit(crash.image, crash.rect)
|
||||
yourtimetext = font.render(str("Your Time"), True, pygame.Color('white'))
|
||||
screen.blit(yourtimetext, (350, 400))
|
||||
yourtime = font.render(str(playtime), True, pygame.Color('white'))
|
||||
screen.blit(yourtime, (350, 440))
|
||||
#rfps = font.render(str(int(rstate)), True, pygame.Color('white'))
|
||||
rfps = font.render(str(int(clock.get_fps())), True, pygame.Color('white'))
|
||||
screen.blit(rfps, (50, 50))
|
||||
if debug:
|
||||
sysclock = font.render(str(datetime.datetime.utcnow()), True, pygame.Color('white'))
|
||||
cpuarch = font.render(str(platform.machine()), True, pygame.Color('white'))
|
||||
playcount = font.render(str(runtime), True, pygame.Color('white'))
|
||||
infox = font.render(str(ax), True, pygame.Color('white'))
|
||||
infoy = font.render(str(ay), True, pygame.Color('white'))
|
||||
infox = font.render(str(bx), True, pygame.Color('white'))
|
||||
infoy = font.render(str(by), True, pygame.Color('white'))
|
||||
screen.blit(sysclock, (120, 50))
|
||||
screen.blit(cpuarch, (50, 80))
|
||||
screen.blit(playcount, (160, 80))
|
||||
|
|
Loading…
Reference in a new issue