Skip to content
Permalink
Browse files

Added clouds

  • Loading branch information
MysteryCoder456 committed Mar 26, 2020
1 parent 73c23fb commit 17e1de4db5732572b6e3a94298f202b5a92be464
Showing with 17 additions and 5 deletions.
  1. +9 −4 game/entities/cloud.py
  2. +8 −1 game/states/game.py
@@ -6,7 +6,12 @@


class Cloud(Entity):
def __init__(self, app, scene, player):
pos = vec3(0, 200, -5000)
vel = vec3(randint(-15, 15), 0, player.velocity.z)
super().__init__(app, scene, SHIP_IMAGE_PATH, position=pos, velocity=vel)
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,6 +1,7 @@
#!/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
@@ -29,7 +30,6 @@ def __init__(self, app, state=None):
self.camera = self.scene.add(Camera(app, self.scene, self.app.size))
self.scene.add(Ground(app, self.scene, GROUND_HEIGHT))
self.player = self.scene.add(Player(app, self.scene))
self.cloud = self.scene.add(Cloud(app, self.scene, self.player))
# self.msg = self.scene.add(Message(self.app, self.scene, "HELLO"))

self.scene.script = Level1
@@ -40,6 +40,13 @@ def __init__(self, app, state=None):

self.time = 0

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

def pend(self):

# self.dirty = True

0 comments on commit 17e1de4

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