Skip to content

Commit

Permalink
v0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
titos-carrasco committed Jun 23, 2022
1 parent 5c3a625 commit c9e1053
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 11 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# ChangeLog

# v0.7.0 2022-06-22
- Agrega método LittleGameEngine.contains() para obtener todos los GameObjects que contienen a un punto dado

# 2022-06-22
- Crea clase ImagesManager para el manejo de imagen
- Crea clase ImageManager para el manejo de imagen
- Crea clase SoundManager para el manejo de sonidos
- Crea clase Fontmanager para el manejo de fonts
- Manejo de imágenes, sonido y fonts se llevan a las clases señaladas
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"name": "lge",
"package_dir": {"": "src/rcr"},
"packages": ["lge"],
"version": "0.6.0",
"version": "0.7.0",
}

setup(**SETUP)
16 changes: 16 additions & 0 deletions src/rcr/lge/LittleGameEngine.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,22 @@ def collidesWith(self, gobj) -> list:

return []

def contains(self, layer:int, position:tuple):
"""
Obtiene todos los GameObjects de una capa dada que contienen un punto especificado
**Parametros**
: *layer* : la capa a revisar
: *position: : el punto a revisar
**Retorna**
: *list* : los GameObjects que contienen al punto
"""
x, y = position
return [o
for o in self.gLayers[layer]
if o.rect.contains(x, y)]

# ------ camera ------
def getCameraPosition(self) -> tuple:
"""
Expand Down
4 changes: 2 additions & 2 deletions src/test/Benchmarks/Birds.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ def __init__(self):
# agregamos pajaros
ww, wh = self.lge.getCameraSize()
for i in range(500):
x = random.random() * ww
y = 15 + random.random() * wh
x = random.randint(0, ww)
y = random.randint(15, wh)
bird = Bird("bird", (x, y))
self.lge.addGObject(bird, 1)

Expand Down
6 changes: 3 additions & 3 deletions src/test/Benchmarks/Bouncing.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ def __init__(self, fps):

# los objetos a rebotar
for i in range(200):
x = 50 + random.random() * 700
y = 50 + random.random() * 150
vx = -50 + random.random() * 100
x = random.randint(50, 750)
y = random.randint(50, 200)
vx = random.randint(-50, 50)
vy = 0
gobj = Ball(x, y, vx, vy)
self.lge.addGObject(gobj, 1)
Expand Down
8 changes: 4 additions & 4 deletions src/test/Benchmarks/Particles.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ def __init__(self):
self.numParticles = 500
self.particles = [0] * self.numParticles
for i in range(self.numParticles):
x = 300 + random.random() * 200
y = 100 + random.random() * 100
vx = -120 + random.random() * 240
vy = -120 + random.random() * 240
x = random.randint(300, 500)
y = random.randint(100, 200)
vx = random.randint(-120, 120)
vy = random.randint(-120, 120)
m = 0.1 + random.random()
self.particles[i] = Particle(x, y, vx, vy, m)

Expand Down

0 comments on commit c9e1053

Please sign in to comment.