Merge branch 'master' of https://github.com/callmebg/PythonPlantsVsZombies
This commit is contained in:
commit
5a829a288a
BIN
resources/huawen.TTF
Normal file
BIN
resources/huawen.TTF
Normal file
Binary file not shown.
@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
import random
|
import random
|
||||||
import pygame as pg
|
import pygame as pg
|
||||||
from .. import tool
|
from .. import tool
|
||||||
@ -25,7 +26,9 @@ plant_frozen_time_list = [7500, 7500, 7500, 30000, 50000, 7500, 7500, 7500, 7500
|
|||||||
all_card_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
|
all_card_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
|
||||||
|
|
||||||
def getSunValueImage(sun_value):
|
def getSunValueImage(sun_value):
|
||||||
font = pg.font.SysFont(None, 22)
|
# for pack, must use other ttf
|
||||||
|
fontPath = os.path.join('resources', 'huawen.TTF')
|
||||||
|
font = pg.font.Font(fontPath, 14)
|
||||||
width = 32
|
width = 32
|
||||||
msg_image = font.render(str(sun_value), True, c.NAVYBLUE, c.LIGHTYELLOW)
|
msg_image = font.render(str(sun_value), True, c.NAVYBLUE, c.LIGHTYELLOW)
|
||||||
msg_rect = msg_image.get_rect()
|
msg_rect = msg_image.get_rect()
|
||||||
|
|||||||
@ -4,11 +4,12 @@ from abc import abstractmethod
|
|||||||
import pygame as pg
|
import pygame as pg
|
||||||
from . import constants as c
|
from . import constants as c
|
||||||
|
|
||||||
|
# an abstract class, one state of automata
|
||||||
class State():
|
class State():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.start_time = 0.0
|
self.start_time = 0.0
|
||||||
self.current_time = 0.0
|
self.current_time = 0.0
|
||||||
self.done = False
|
self.done = False # is it finished
|
||||||
self.next = None
|
self.next = None
|
||||||
self.persist = {}
|
self.persist = {}
|
||||||
|
|
||||||
@ -24,6 +25,7 @@ class State():
|
|||||||
def update(self, surface, keys, current_time):
|
def update(self, surface, keys, current_time):
|
||||||
'''abstract method'''
|
'''abstract method'''
|
||||||
|
|
||||||
|
# control this game. do event loops
|
||||||
class Control():
|
class Control():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.screen = pg.display.get_surface()
|
self.screen = pg.display.get_surface()
|
||||||
@ -73,6 +75,8 @@ class Control():
|
|||||||
self.mouse_pos = pg.mouse.get_pos()
|
self.mouse_pos = pg.mouse.get_pos()
|
||||||
self.mouse_click[0], _, self.mouse_click[1] = pg.mouse.get_pressed()
|
self.mouse_click[0], _, self.mouse_click[1] = pg.mouse.get_pressed()
|
||||||
print('pos:', self.mouse_pos, ' mouse:', self.mouse_click)
|
print('pos:', self.mouse_pos, ' mouse:', self.mouse_click)
|
||||||
|
else:
|
||||||
|
print(pg.event.event_name(event.type))
|
||||||
|
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user