class Data: """place changable state variables here.""" question_text = coda.TextObject(coda.color.WHITE, 16, "") grade_text = coda.TextObject(coda.color.WHITE, 16, "") buttons = [] button_text = [] correct_answer_index = 0 question_number = 0 answered_correctly = 0 last_answered_question = -1
def __init__(self, name, health, attack, shield): """Default constructor for player class.""" self.name = name self.health = Stat(health, 0) self.attack = Stat(attack, 0) self.shield = Stat(shield, 0) self.hand = [] self.effects = [] self.health_text = coda.TextObject( coda.color.BLACK, 15, "Health: " + str(self.health.value())) self.attack_text = coda.TextObject( coda.color.BLACK, 15, "Attack: " + str(self.attack.value())) self.shield_text = coda.TextObject( coda.color.BLACK, 15, "shield: " + str(self.shield.value()))
class Data: """place changable state variables here.""" info = coda.TextObject(coda.color.BLACK, 32, "") button = coda.Object(IMAGE_BUTTON) character = coda.Object(IMAGE_CHARACTER_1) background = coda.Object(IMAGE_BACKGROUND) selection = 1
class Data: """Modifiable data""" tilesheet = coda.SpriteSheet("tileset.png", (32, 32)) player_sheet = coda.SpriteSheet("player_sheet.png", (42, 48)) tilemap = [] floors = [] walls = [] player_start_position = coda.Vector2(0, 0) boss_start_position = coda.Vector2(0, 0) player = coda.Object(tilesheet.image_at(0)) boss = coda.Object(BOSS_IMAGE) player_health = 100 boss_health = 300 player_dir = coda.dir.UP timer1 = coda.CountdownTimer(0.1) timer3 = coda.CountdownTimer(0.1) numberOfBullets = 0 bullets = [] bullet_owner = [] rotation_speed = 180 state = 0 last_state = 2 player_text = coda.TextObject(coda.color.BLACK, 24, "Player: ") player_hitbox = coda.Object(PROJECTILE_IMAGE) index = 0 boss_logic = coda.StateMachine() player_logic = coda.StateMachine()
def initialize(window): """Initialize Quiz State.""" for index in range(4): MY.buttons.append(coda.Object(IMAGE_BUTTON)) MY.buttons[index].location = (window.x / 2, window.y / 2 + index * 64) obj = coda.TextObject(coda.color.BLACK, 16, "") obj.centered = True obj.location = MY.buttons[index].location MY.button_text.append(obj) MY.question_text.location = (window.x / 2, 64) MY.question_text.centered = True set_up_question()
class Data: """place changable state variables here.""" info = coda.TextObject(coda.color.WHITE, 64, "") button = coda.Object(IMAGE_BUTTON) snake = coda.Object(IMAGE_SNAKE_1) selection = 1
class Data: """place changable state variables here.""" restart_button = coda.Object(IMAGE_BUTTON) display_text = coda.TextObject(coda.color.WHITE, 24, "Player 2 wins! Play again?")