did work on score and added all the alphabet sprites

This commit is contained in:
EggMan 2024-04-29 13:45:50 -04:00
parent 793d3025db
commit c5f14059e0
29 changed files with 97 additions and 4 deletions

View File

@ -3,6 +3,7 @@
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" />
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.11 (CNSA-266-FP)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />

View File

@ -2,7 +2,7 @@ import random
import sys
import time
import arcade
import Score
from Score import Score
from Bullet import Bullet
from Alien import Alien
@ -210,6 +210,8 @@ class MyGame(arcade.Window):
self.player_list.draw(pixelated=True)
self.wall_list.draw(pixelated=True)
self.score.drawEach()
def KillBullet(self):
self.bullet = None
self.activeBullet = False
@ -231,6 +233,7 @@ class MyGame(arcade.Window):
print(str(self.Score))
sys.exit()
def update(self, delta_time):
if self.somethingalsi:
@ -404,6 +407,8 @@ class MyGame(arcade.Window):
else:
self.death()
self.score.update(self.Score)
def main():

View File

@ -2,6 +2,8 @@ import sys
import arcade
LEFT_OFFSET = 8
class Score(arcade.Sprite):
def __init__(self, SCREEN_SCALE, DEBUG):
super().__init__()
@ -11,6 +13,7 @@ class Score(arcade.Sprite):
self.scScale = SCREEN_SCALE
self.deBuggin = DEBUG
self.value = 0
self.sprites = []
def setValue(self, newValue):
self.value = newValue
@ -18,9 +21,93 @@ class Score(arcade.Sprite):
def getValue(self):
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/Numbers/0.png", self.scScale))
self.value = score
valArr = []
for value in str(self.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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB