Заготовка игры танки
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import arcade
|
||||
import math
|
||||
|
||||
class Bullet(arcade.Sprite):
|
||||
ls = arcade.SpriteList()
|
||||
def __init__(self,x,y,a,shift=0):
|
||||
super().__init__(
|
||||
'./assets/laserBlue01.png',
|
||||
scale=0.7)
|
||||
self.angle = a
|
||||
self.center_x = x + math.sin(self.angle * math.pi / 180) * shift
|
||||
self.center_y = y + math.cos(self.angle * math.pi / 180) * shift
|
||||
self.speed = 10
|
||||
Bullet.ls.append(self)
|
||||
|
||||
@classmethod
|
||||
def update_list(cls):
|
||||
for bullet in cls.ls:
|
||||
bullet.change_x = math.sin(bullet.angle * math.pi / 180) * bullet.speed
|
||||
bullet.change_y = math.cos(bullet.angle * math.pi / 180) * bullet.speed
|
||||
bullet.update()
|
||||
|
||||
@classmethod
|
||||
def draw(cls):
|
||||
cls.ls.draw()
|
||||
|
||||
Reference in New Issue
Block a user