Skip to content
Permalink
Browse files

Merge branch 'master' of github.com:PythonixCoders/PyWeek29

  • Loading branch information
flipcoder committed Mar 26, 2020
2 parents e055ff7 + cbddffd commit 6e1070df3b7a044381e4d14ea1ff9df56cbbe2e4
Showing with 40 additions and 1 deletion.
  1. +1 −0 game/constants.py
  2. +17 −0 game/entities/cloud.py
  3. +12 −0 game/scripts/level.py
  4. +10 −1 game/states/game.py
@@ -20,6 +20,7 @@
CROSSHAIR_IMAGE_PATH = "crosshair.png"
CROSSHAIR_GREEN_IMAGE_PATH = "crosshair_green.png"
BULLET_IMAGE_PATH = "bullet.png"
CLOUD_IMAGE_PATH = "cloud.png"

ORANGE = (255, 165, 0)
GREEN = (141, 178, 85)
@@ -0,0 +1,17 @@
from game.base.entity import Entity
from game.constants import SPRITES_DIR, CLOUD_IMAGE_PATH, SHIP_IMAGE_PATH
from glm import vec3
from random import randint
import os


class Cloud(Entity):
if randint(0, 10) <= 5:
hdg = -1
else:
hdg = 1

def __init__(self, app, scene, pos: vec3, z_vel: float):
vel = vec3(randint(0, 15) * Cloud.hdg, 0, z_vel)

super().__init__(app, scene, SHIP_IMAGE_PATH, position=pos, velocity=vel)
@@ -1,9 +1,11 @@
import pygame
from glm import vec3, ivec2
from pygame.camera import Camera
from random import randint

from game.entities.butterfly import Butterfly
from game.entities.camera import Camera
from game.entities.cloud import Cloud
from game.util import random_color


@@ -47,6 +49,8 @@ def pause(self, duration):

def __call__(self):
self.scene.sky_color = self.sky
self.cloudy()

if self.name:
terminal = self.app.state.terminal
typ = pygame.mixer.Sound("data/sounds/type.wav")
@@ -75,5 +79,13 @@ def __call__(self):
terminal.clear(left + (i, 0))
yield self.pause(0.04)

def cloudy(self):
for i in range(20):
x = randint(-2000, 2000)
y = randint(300, 600)
z = randint(-7000, -3000)
pos = vec3(x, y, z)
self.scene.add(Cloud(self.app, self.scene, pos, self.app.state.player.velocity.z))

def __iter__(self):
return self()
@@ -1,13 +1,15 @@
#!/usr/bin/env python
import pygame
from glm import vec3, sign
from random import randint

from game.base.inputs import Inputs, Axis, Button
from game.base.state import State
from game.constants import GROUND_HEIGHT
from game.entities.camera import Camera
from game.entities.ground import Ground
from game.entities.player import Player
from game.entities.cloud import Cloud
from game.entities.terminal import Terminal
from game.scene import Scene
from game.scripts.level1 import Level1
@@ -43,9 +45,16 @@ def __init__(self, app, state=None):
app.inputs['debug'].on_press(lambda _: self.debug_mode(True)),
app.inputs['debug'].on_release(lambda _: self.debug_mode(False))
]

for i in range(20):
x = randint(-2000, 2000)
y = randint(300, 600)
z = randint(-7000, -3000)
pos = vec3(x, y, z)
self.scene.add(Cloud(self.app, self.scene, pos, self.player.velocity.z))

self.time = 0

def debug_mode(self, b):
self.debug = b
self.terminal.clear(20)

0 comments on commit 6e1070d

Please sign in to comment.
You can’t perform that action at this time.