Added pseudo-tutorial
This commit is contained in:
parent
932c68d6c3
commit
59a7b97b94
BIN
gamedata/assets/cursor/0.png
Normal file
BIN
gamedata/assets/cursor/0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
gamedata/assets/cursor/1.png
Normal file
BIN
gamedata/assets/cursor/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
40
gamedata/objects/ingame/demo.py
Normal file
40
gamedata/objects/ingame/demo.py
Normal file
@ -0,0 +1,40 @@
|
||||
from gamedata.objects.base import BaseObject
|
||||
import math
|
||||
|
||||
class Demo(BaseObject):
|
||||
|
||||
def __init__(self,game):
|
||||
|
||||
super().__init__(game.DISPLAY_WIDTH/2,game.DISPLAY_HEIGHT/2,game,0,0)
|
||||
|
||||
self.blinktimer = game.lib.Timer(0.5)
|
||||
self.pinmik = game.gameloop.findname("Lemming")[0]
|
||||
self.move()
|
||||
|
||||
self.maxblink = 6
|
||||
|
||||
self.depth = 6
|
||||
|
||||
def move(self):
|
||||
self.rect[0] = self.pinmik.rect.center[0]
|
||||
self.rect[1] = self.pinmik.rect.center[1]+50
|
||||
|
||||
def step(self):
|
||||
|
||||
self.blinktimer.tick(self.game.dt)
|
||||
|
||||
if self.blinktimer.getloops()>=self.maxblink:
|
||||
self.game.gameloop.delid(self.id)
|
||||
self.move()
|
||||
|
||||
def draw(self):
|
||||
sprites = self.game.getSpriteDir("cursor/")
|
||||
sprite = sprites[self.blinktimer.getloops()%2]
|
||||
if self.blinktimer.getloops()>=self.maxblink-1:
|
||||
sprite.set_alpha(self.blinktimer.getratio()*255)
|
||||
elif self.blinktimer.getloops()==0:
|
||||
sprite.set_alpha((1-self.blinktimer.getratio())*255)
|
||||
else:
|
||||
sprite.set_alpha(255)
|
||||
if self.blinktimer.getloops()<self.maxblink:
|
||||
self.game.lib.drawcenter(self.game,sprite,self.rect[0],self.rect[1])
|
@ -3,6 +3,7 @@ from gamedata.objects.ingame.spawner import Spawner
|
||||
from gamedata.objects.ingame.tiles import Tiles
|
||||
from gamedata.objects.ingame.clouds import Clouds
|
||||
from gamedata.objects.ingame.skies import Skies
|
||||
from gamedata.objects.ingame.demo import Demo
|
||||
|
||||
class Manager(BaseObject):
|
||||
def __init__(self,game):
|
||||
@ -38,6 +39,10 @@ class Manager(BaseObject):
|
||||
# Spawn the first one
|
||||
self.game.gameloop.summon(Spawner(self.game,self.tiles))
|
||||
|
||||
# Demo
|
||||
self.demo = None
|
||||
self.demotimer = game.lib.Timer(4)
|
||||
|
||||
def step(self):
|
||||
nblemmings = len(self.game.gameloop.findname("Lemming")) + len(self.game.gameloop.findname("Spawner"))
|
||||
# Updating score
|
||||
@ -59,6 +64,10 @@ class Manager(BaseObject):
|
||||
if self.deathtimer.tick(self.game.dt):
|
||||
self.invincible = False
|
||||
|
||||
if not self.demo:
|
||||
if self.demotimer.tick(self.game.dt):
|
||||
self.demo = self.game.gameloop.summon(Demo(self.game))
|
||||
|
||||
def death(self):
|
||||
if not self.invincible:
|
||||
self.lives-=1
|
||||
|
Loading…
Reference in New Issue
Block a user