Merge remote-tracking branch 'origin/master'
@ -3,6 +3,7 @@
|
|||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="jdk" jdkName="Python 3.11 (CNSA-266-FP)" jdkType="Python SDK" />
|
<orderEntry type="jdk" jdkName="Python 3.11 (CNSA-266-FP)" jdkType="Python SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
7
Main.py
@ -2,7 +2,7 @@ import random
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import arcade
|
import arcade
|
||||||
import Score
|
from Score import Score
|
||||||
|
|
||||||
from Bullet import Bullet
|
from Bullet import Bullet
|
||||||
from Alien import Alien
|
from Alien import Alien
|
||||||
@ -210,6 +210,8 @@ class MyGame(arcade.Window):
|
|||||||
|
|
||||||
self.player_list.draw(pixelated=True)
|
self.player_list.draw(pixelated=True)
|
||||||
self.wall_list.draw(pixelated=True)
|
self.wall_list.draw(pixelated=True)
|
||||||
|
|
||||||
|
self.score.drawEach()
|
||||||
def KillBullet(self):
|
def KillBullet(self):
|
||||||
self.bullet = None
|
self.bullet = None
|
||||||
self.activeBullet = False
|
self.activeBullet = False
|
||||||
@ -231,6 +233,7 @@ class MyGame(arcade.Window):
|
|||||||
print(str(self.Score))
|
print(str(self.Score))
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
|
||||||
def update(self, delta_time):
|
def update(self, delta_time):
|
||||||
|
|
||||||
if self.somethingalsi:
|
if self.somethingalsi:
|
||||||
@ -404,6 +407,8 @@ class MyGame(arcade.Window):
|
|||||||
else:
|
else:
|
||||||
self.death()
|
self.death()
|
||||||
|
|
||||||
|
self.score.update(self.Score)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
97
Score.py
@ -2,6 +2,8 @@ import sys
|
|||||||
|
|
||||||
import arcade
|
import arcade
|
||||||
|
|
||||||
|
LEFT_OFFSET = 8
|
||||||
|
|
||||||
class Score(arcade.Sprite):
|
class Score(arcade.Sprite):
|
||||||
def __init__(self, SCREEN_SCALE, DEBUG):
|
def __init__(self, SCREEN_SCALE, DEBUG):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
@ -11,6 +13,7 @@ class Score(arcade.Sprite):
|
|||||||
self.scScale = SCREEN_SCALE
|
self.scScale = SCREEN_SCALE
|
||||||
self.deBuggin = DEBUG
|
self.deBuggin = DEBUG
|
||||||
self.value = 0
|
self.value = 0
|
||||||
|
self.sprites = []
|
||||||
|
|
||||||
def setValue(self, newValue):
|
def setValue(self, newValue):
|
||||||
self.value = newValue
|
self.value = newValue
|
||||||
@ -18,9 +21,97 @@ class Score(arcade.Sprite):
|
|||||||
def getValue(self):
|
def getValue(self):
|
||||||
return self.value
|
return self.value
|
||||||
|
|
||||||
def update(self):
|
def drawEach(self):
|
||||||
|
for sprite in self.sprites:
|
||||||
|
sprite.draw(pixelated=True)
|
||||||
|
|
||||||
|
def update(self, score):
|
||||||
|
self.sprites.clear()
|
||||||
|
|
||||||
|
self.sprites.append(arcade.Sprite("assets/Sprites/Letters/s.png", self.scScale)) # add x and y coords
|
||||||
|
self.sprites.append(arcade.Sprite("assets/Sprites/Letters/c.png", self.scScale)) # add x and y coords
|
||||||
|
self.sprites.append(arcade.Sprite("assets/Sprites/Letters/o.png", self.scScale)) # add x and y coords
|
||||||
|
self.sprites.append(arcade.Sprite("assets/Sprites/Letters/r.png", self.scScale)) # add x and y coords
|
||||||
|
self.sprites.append(arcade.Sprite("assets/Sprites/Letters/e.png", self.scScale)) # add x and y coords
|
||||||
|
|
||||||
|
self.value = score
|
||||||
|
|
||||||
valArr = []
|
valArr = []
|
||||||
for value in str(self.value):
|
for value in str(self.value):
|
||||||
valArr.append(value)
|
valArr.append(value)
|
||||||
print(valArr)
|
|
||||||
sys.exit()
|
if self.deBuggin:
|
||||||
|
print(valArr)
|
||||||
|
# sys.exit()
|
||||||
|
|
||||||
|
for index, val in enumerate(valArr):
|
||||||
|
if val == "0":
|
||||||
|
addSprite = arcade.Sprite("assets/Sprites/Numbers/0.png", self.scScale)
|
||||||
|
addSprite.center_y = self.scScale * 250
|
||||||
|
addSprite.center_x = self.scScale * (index*8) + (self.scScale * LEFT_OFFSET)
|
||||||
|
self.sprites.append(addSprite)
|
||||||
|
if self.deBuggin:
|
||||||
|
print(addSprite.center_x)
|
||||||
|
elif val == "1":
|
||||||
|
addSprite = arcade.Sprite("assets/Sprites/Numbers/1.png", self.scScale)
|
||||||
|
addSprite.center_y = self.scScale * 250
|
||||||
|
addSprite.center_x = self.scScale * (index*8) + (self.scScale * LEFT_OFFSET)
|
||||||
|
self.sprites.append(addSprite)
|
||||||
|
if self.deBuggin:
|
||||||
|
print(addSprite.center_x)
|
||||||
|
elif val == "2":
|
||||||
|
addSprite = arcade.Sprite("assets/Sprites/Numbers/2.png", self.scScale)
|
||||||
|
addSprite.center_y = self.scScale * 250
|
||||||
|
addSprite.center_x = self.scScale * (index*8) + (self.scScale * LEFT_OFFSET)
|
||||||
|
self.sprites.append(addSprite)
|
||||||
|
if self.deBuggin:
|
||||||
|
print(addSprite.center_x)
|
||||||
|
elif val == "3":
|
||||||
|
addSprite = arcade.Sprite("assets/Sprites/Numbers/3.png", self.scScale)
|
||||||
|
addSprite.center_y = self.scScale * 250
|
||||||
|
addSprite.center_x = self.scScale * (index*8) + (self.scScale * LEFT_OFFSET)
|
||||||
|
self.sprites.append(addSprite)
|
||||||
|
if self.deBuggin:
|
||||||
|
print(addSprite.center_x)
|
||||||
|
elif val == "4":
|
||||||
|
addSprite = arcade.Sprite("assets/Sprites/Numbers/4.png", self.scScale)
|
||||||
|
addSprite.center_y = self.scScale * 250
|
||||||
|
addSprite.center_x = self.scScale * (index*8) + (self.scScale * LEFT_OFFSET)
|
||||||
|
self.sprites.append(addSprite)
|
||||||
|
if self.deBuggin:
|
||||||
|
print(addSprite.center_x)
|
||||||
|
elif val == "5":
|
||||||
|
addSprite = arcade.Sprite("assets/Sprites/Numbers/5.png", self.scScale)
|
||||||
|
addSprite.center_y = self.scScale * 250
|
||||||
|
addSprite.center_x = self.scScale * (index*8) + (self.scScale * LEFT_OFFSET)
|
||||||
|
self.sprites.append(addSprite)
|
||||||
|
if self.deBuggin:
|
||||||
|
print(addSprite.center_x)
|
||||||
|
elif val == "6":
|
||||||
|
addSprite = arcade.Sprite("assets/Sprites/Numbers/6.png", self.scScale)
|
||||||
|
addSprite.center_y = self.scScale * 250
|
||||||
|
addSprite.center_x = self.scScale * (index*8) + (self.scScale * LEFT_OFFSET)
|
||||||
|
self.sprites.append(addSprite)
|
||||||
|
if self.deBuggin:
|
||||||
|
print(addSprite.center_x)
|
||||||
|
elif val == "7":
|
||||||
|
addSprite = arcade.Sprite("assets/Sprites/Numbers/7.png", self.scScale)
|
||||||
|
addSprite.center_y = self.scScale * 250
|
||||||
|
addSprite.center_x = self.scScale * (index*8) + (self.scScale * LEFT_OFFSET)
|
||||||
|
self.sprites.append(addSprite)
|
||||||
|
if self.deBuggin:
|
||||||
|
print(addSprite.center_x)
|
||||||
|
elif val == "8":
|
||||||
|
addSprite = arcade.Sprite("assets/Sprites/Numbers/8.png", self.scScale)
|
||||||
|
addSprite.center_y = self.scScale * 250
|
||||||
|
addSprite.center_x = self.scScale * (index*8) + (self.scScale * LEFT_OFFSET)
|
||||||
|
self.sprites.append(addSprite)
|
||||||
|
if self.deBuggin:
|
||||||
|
print(addSprite.center_x)
|
||||||
|
elif val == "9":
|
||||||
|
addSprite = arcade.Sprite("assets/Sprites/Numbers/9.png", self.scScale)
|
||||||
|
addSprite.center_y = self.scScale * 250
|
||||||
|
addSprite.center_x = self.scScale * (index*8) + (self.scScale * LEFT_OFFSET)
|
||||||
|
self.sprites.append(addSprite)
|
||||||
|
if self.deBuggin:
|
||||||
|
print(addSprite.center_x)
|
||||||
|
BIN
assets/Sprites/Letters/a.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/Sprites/Letters/b.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/Sprites/Letters/c.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/Sprites/Letters/d.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/Sprites/Letters/e.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/Sprites/Letters/f.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/Sprites/Letters/g.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/Sprites/Letters/h.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/Sprites/Letters/i.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/Sprites/Letters/j.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/Sprites/Letters/k.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/Sprites/Letters/l.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/Sprites/Letters/m.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/Sprites/Letters/n.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/Sprites/Letters/o.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/Sprites/Letters/p.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/Sprites/Letters/q.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/Sprites/Letters/r.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/Sprites/Letters/s.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/Sprites/Letters/t.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/Sprites/Letters/u.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/Sprites/Letters/v.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/Sprites/Letters/w.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/Sprites/Letters/x.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/Sprites/Letters/y.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/Sprites/Letters/z.png
Normal file
After Width: | Height: | Size: 1.1 KiB |