Beispiel #1
0
"""General information on your module and what it does."""
import coda_kids as coda

#load sprites
IMAGE_BACKGROUND = coda.Image("assets/background.jpg")
IMAGE_PLAYER1 = coda.Image("assets/player1.png")
IMAGE_PLAYER2 = coda.Image("assets/player2.png")
IMAGE_ASTEROID = coda.Image("assets/asteroid.png")
IMAGE_ASTEROID_2 = coda.Image("assets/asteroid2.png")
SOUND_EXPLOSIONS = [coda.Sound("assets/Explosion1.wav"),
                    coda.Sound("assets/Explosion2.wav")]

SOUND_LASER = [coda.Sound("assets/Laser_Shoot1.wav"),
               coda.Sound("assets/Laser_Shoot2.wav")]

SPRITESHEET_PROJECTILE = [None,
                          coda.SpriteSheet("assets/player1_projectile.png", (36, 24)),
                          coda.SpriteSheet("assets/player2_projectile.png", (48, 48))]
PROJECTILE_ANIMATION = [None,
                        coda.Animator(SPRITESHEET_PROJECTILE[1], 0.4),
                        coda.Animator(SPRITESHEET_PROJECTILE[2], 0.4)]

# constants
SHIP_ROTATE_SPEED = 120
SHIP_MAX_SPEED = 500
SHIP_ACCEL = 10
BULLET_SPEED = 1000
PLAYER_MAX_HP = 10

class Data:
    """place changable state variables here."""
Beispiel #2
0
"""General information on your module and what it does."""
import coda_kids as coda

#load sprites
BUTTON_IMAGE = coda.Image("WinButton.png")


class Data:
    Button = coda.Object(BUTTON_IMAGE)


MY = Data()


def initialize(window):
    """Initializes the lose menu state."""
    MY.Button.location = window / 2


def update(delta_time):
    """Updates the lose menu state."""
    for event in coda.event.listing():
        if coda.event.quit_game(event):
            coda.stop()
        elif coda.event.mouse_l_button_down(event):
            if MY.Button.collides_with_point(coda.event.mouse_position()):
                coda.state.change(0)


def draw(screen):
    """Draws the lose menu state."""
Beispiel #3
0
"""General information on your module and what it does."""
import coda_kids as coda

#load sprites constants
IMAGE_BUTTON = coda.Image("button.png")
IMAGE_SNAKE_1 = coda.Image("Snake_1.png")
IMAGE_SNAKE_2 = coda.Image("Snake_2.png")
IMAGE_SNAKE_3 = coda.Image("Snake_3.png")
IMAGE_SNAKE_4 = coda.Image("Snake_4.png")
IMAGE_SNAKE_5 = coda.Image("Snake_5.png")

SOUND_CHARACTER = [[coda.Sound("Select_1.wav"),
                    coda.Sound("Select_2.wav")],
                   [coda.Sound("Select_1.wav"),
                    coda.Sound("Select_2.wav")],
                   [coda.Sound("Select_1.wav"),
                    coda.Sound("Select_2.wav")],
                   [coda.Sound("Select_1.wav"),
                    coda.Sound("Select_2.wav")],
                   [coda.Sound("Select_1.wav"),
                    coda.Sound("Select_2.wav")]]

# text constants
TEXT_1 = "I am snake 1!"
TEXT_2 = "I am snake 2!"
TEXT_3 = "I am snake 3!"
TEXT_4 = "I am snake 4!"
TEXT_5 = "I am snake 5!"


class Data:
Beispiel #4
0
"""General information on your module and what it does."""
import coda_kids as coda

# load sprites
IMAGE_BUTTON = coda.Image("button.png")

# modifiable data
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?")

MY = Data()

def initialize(window):
    """Initializes the restart menu state."""
    MY.restart_button.location = window / 2

def update(delta_time):
    """Updates the restart menu state."""
    for event in coda.event.listing():
        if coda.event.quit_game(event):
            coda.stop()
        if coda.event.mouse_l_button_down(event):
            if MY.restart_button.collides_with_point(coda.event.mouse_position()):
                coda.state.change(0)

def draw(screen):
    """Draws the restart menu state."""
    MY.restart_button.draw(screen)
    MY.display_text.draw(screen)
Beispiel #5
0
"""General information on your module and what it does."""
import coda_kids as coda

# load sprites
IMAGE_BUTTON = coda.Image("assets/button.png")

# modifiable data
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?")

MY = Data()

def initialize(window):
    """Initializes the restart menu state."""
    MY.restart_button.location = window / 2

def update(delta_time):
    """Updates the restart menu state."""
    for event in coda.event.listing():
        if coda.event.quit_game(event):
            coda.stop()
        if coda.event.mouse_l_button_down(event):
            if MY.restart_button.collides_with_point(coda.event.mouse_position()):
                coda.state.change(0)

def draw(screen):
    """Draws the restart menu state."""
    MY.restart_button.draw(screen)
    MY.display_text.draw(screen)
Beispiel #6
0
"""General information on your module and what it does."""
import coda_kids as coda

#load sprites
BUTTON_IMAGE = coda.Image("LoseButton.png")


class Data:
    Button = coda.Object(BUTTON_IMAGE)


MY = Data()


def initialize(window):
    """Initializes the lose menu state."""
    MY.Button.location = window / 2


def update(delta_time):
    """Updates the lose menu state."""
    for event in coda.event.listing():
        if coda.event.quit_game(event):
            coda.stop()
        elif coda.event.mouse_l_button_down(event):
            if MY.Button.collides_with_point(coda.event.mouse_position()):
                coda.state.change(0)


def draw(screen):
    """Draws the lose menu state."""
Beispiel #7
0
"""General information on your module and what it does."""
import coda_kids as coda

#load sprites constants
IMAGE_BACKGROUND = coda.Image("assets/ClassroomBackground.png")
IMAGE_BUTTON = coda.Image("assets/button.png")
IMAGE_CHARACTER_1 = coda.Image("assets/Character_1.png")
IMAGE_CHARACTER_2 = coda.Image("assets/Character_2.png")
IMAGE_CHARACTER_3 = coda.Image("assets/Character_3.png")
IMAGE_CHARACTER_4 = coda.Image("assets/Character_4.png")
IMAGE_CHARACTER_5 = coda.Image("assets/Character_5.png")
IMAGE_CHARACTER_6 = coda.Image("assets/Character_6.png")
IMAGE_CHARACTER_7 = coda.Image("assets/Character_7.png")
IMAGE_CHARACTER_8 = coda.Image("assets/Character_8.png")
IMAGE_CHARACTER_9 = coda.Image("assets/Character_9.png")
IMAGE_CHARACTER_10 = coda.Image("assets/Character_10.png")
IMAGE_CHARACTER_11 = coda.Image("assets/Character_11.png")
IMAGE_CHARACTER_12 = coda.Image("assets/Character_12.png")

SOUND_CHARACTER = [
    [
        coda.Sound("assets/Select_1.wav"),
        coda.Sound("assets/Select_2.wav")
    ],
    [
        coda.Sound("assets/Select_1.wav"),
        coda.Sound("assets/Select_2.wav")
    ],
    [
        coda.Sound("assets/Select_1.wav"),
        coda.Sound("assets/Select_2.wav")
Beispiel #8
0
"""General information on your module and what it does."""
import coda_kids as coda

#load sprites constants
BOSS_IMAGE = coda.Image("boss.png")
PROJECTILE_IMAGE = coda.Image("projectile.png")
PLAYER_ATTACK_1_IMAGE = coda.Image("attack_1.png")
PLAYER_ATTACK_2_IMAGE = coda.Image("attack_2.png")
PLAYER_ATTACK_3_IMAGE = coda.Image("attack_3.png")

#constants
PLAYER = 0
BOSS = 1
GRASS = 4
TILE_SIZE = 32

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)