diff --git a/assets/story/boss_fight/projectile.png b/assets/story/boss_fight/projectile.png new file mode 100644 index 0000000..7f84506 Binary files /dev/null and b/assets/story/boss_fight/projectile.png differ diff --git a/assets/story/boss_fight/projectiles/projectiles/0000.png b/assets/story/boss_fight/projectiles/projectiles/0000.png new file mode 100644 index 0000000..31dfc1d Binary files /dev/null and b/assets/story/boss_fight/projectiles/projectiles/0000.png differ diff --git a/assets/story/boss_fight/projectiles/projectiles/0001.png b/assets/story/boss_fight/projectiles/projectiles/0001.png new file mode 100644 index 0000000..31dfc1d Binary files /dev/null and b/assets/story/boss_fight/projectiles/projectiles/0001.png differ diff --git a/assets/story/boss_fight/projectiles/projectiles/0002.png b/assets/story/boss_fight/projectiles/projectiles/0002.png new file mode 100644 index 0000000..31dfc1d Binary files /dev/null and b/assets/story/boss_fight/projectiles/projectiles/0002.png differ diff --git a/assets/story/boss_fight/projectiles/projectiles/0003.png b/assets/story/boss_fight/projectiles/projectiles/0003.png new file mode 100644 index 0000000..31dfc1d Binary files /dev/null and b/assets/story/boss_fight/projectiles/projectiles/0003.png differ diff --git a/assets/story/boss_fight/projectiles/projectiles/0004.png b/assets/story/boss_fight/projectiles/projectiles/0004.png new file mode 100644 index 0000000..350217d Binary files /dev/null and b/assets/story/boss_fight/projectiles/projectiles/0004.png differ diff --git a/assets/story/boss_fight/projectiles/projectiles/0005.png b/assets/story/boss_fight/projectiles/projectiles/0005.png new file mode 100644 index 0000000..350217d Binary files /dev/null and b/assets/story/boss_fight/projectiles/projectiles/0005.png differ diff --git a/assets/story/boss_fight/projectiles/projectiles/0006.png b/assets/story/boss_fight/projectiles/projectiles/0006.png new file mode 100644 index 0000000..350217d Binary files /dev/null and b/assets/story/boss_fight/projectiles/projectiles/0006.png differ diff --git a/assets/story/boss_fight/projectiles/projectiles/0007.png b/assets/story/boss_fight/projectiles/projectiles/0007.png new file mode 100644 index 0000000..350217d Binary files /dev/null and b/assets/story/boss_fight/projectiles/projectiles/0007.png differ diff --git a/assets/story/boss_fight/projectiles/projectiles/0008.png b/assets/story/boss_fight/projectiles/projectiles/0008.png new file mode 100644 index 0000000..d6260b7 Binary files /dev/null and b/assets/story/boss_fight/projectiles/projectiles/0008.png differ diff --git a/assets/story/boss_fight/projectiles/projectiles/0009.png b/assets/story/boss_fight/projectiles/projectiles/0009.png new file mode 100644 index 0000000..d6260b7 Binary files /dev/null and b/assets/story/boss_fight/projectiles/projectiles/0009.png differ diff --git a/assets/story/boss_fight/projectiles/projectiles/0010.png b/assets/story/boss_fight/projectiles/projectiles/0010.png new file mode 100644 index 0000000..d6260b7 Binary files /dev/null and b/assets/story/boss_fight/projectiles/projectiles/0010.png differ diff --git a/assets/story/boss_fight/projectiles/projectiles/0011.png b/assets/story/boss_fight/projectiles/projectiles/0011.png new file mode 100644 index 0000000..d6260b7 Binary files /dev/null and b/assets/story/boss_fight/projectiles/projectiles/0011.png differ diff --git a/assets/story/boss_fight/projectiles/projectiles/0012.png b/assets/story/boss_fight/projectiles/projectiles/0012.png new file mode 100644 index 0000000..2d761bd Binary files /dev/null and b/assets/story/boss_fight/projectiles/projectiles/0012.png differ diff --git a/src/scenes/story/boss_fight.py b/src/scenes/story/boss_fight.py index a0baa8d..c8bedc9 100644 --- a/src/scenes/story/boss_fight.py +++ b/src/scenes/story/boss_fight.py @@ -10,12 +10,13 @@ from engine.ecs import World from engine.math import Vec2 from plugins import assets, smooth from plugins import render +from plugins import timing from plugins.animation import Animation from plugins.inputs import Held, Pressed from plugins.render import Sprite from plugins.assets import Assets from plugins.coroutine import wait, Coroutine -from plugins.timing import TimedEvent +from plugins.timing import Delta, TimedEvent class Velocity(int): @@ -96,7 +97,7 @@ def __initialize_world(world: World): origin=Vec2(0.5), ), smooth.Target(world[ShieldPos]), - Velocity(6), + Velocity(500 * world[Delta]), ) @@ -108,6 +109,7 @@ def __move(world: World): s_pos = world[ShieldPos] for entity in world.query(Sprite, Velocity): for key in held: + print(entity[Velocity]) if key in ("up", "z"): if s_pos.y - 45.5 - entity[Velocity] > world[FightBox].p1[1]: s_pos.y -= entity[Velocity] @@ -145,11 +147,25 @@ def __check_hurt(world: World): shield_position = shield.get(Sprite).position shield_width, shield_height = shield.get(Sprite).texture.get_size() - is_collision = not ( - shield_position.y < position.y - or shield_position.y + shield_height > position.y + height - or shield_position.x < position.x - or shield_position.x + shield_width > position.x + width + left1, top1, right1, bottom1 = ( + position.x, + position.y, + position.x + width, + position.y + height, + ) + + left2, top2, right2, bottom2 = ( + shield_position.x - shield_width / 2, + shield_position.y - shield_height / 2, + shield_position.x + shield_width / 2, + shield_position.y + shield_height / 2, + ) + + is_collision = ( + left1 < right2 + and right1 > left2 + and top1 < bottom2 + and bottom1 > top2 ) if is_collision: world.set(Life(world.get(Life) - entity.get(Hurt).damage)) @@ -173,7 +189,7 @@ def __create_zone_attack(world: World): """ double = random.randint(1, 10) locate = random.randint(0, 2) - if double == 10: + if double != 10: animation = Animation("zone_attack", 60) entity = world.new_entity() entity.set( @@ -187,18 +203,19 @@ def __create_zone_attack(world: World): ) yield animation.wait() entity.destroy() - for i in range(8): + for i in range(10): projectiles = world.new_entity() projectiles.set( Sprite( - world[Assets].get_texture("error"), + world[Assets].get_texture("projectile"), Vec2( i * 41 + world[FightBox].p1[0] + (locate * 413), world[FightBox].p1[1], ), 2, ), + Animation("projectiles", 60, True), ZoneAttackProjectiles(), Hurt(10), TimedEvent(0.4, lambda world, entity: entity.destroy()), @@ -229,18 +246,19 @@ def __create_zone_attack(world: World): for entity in world.query(ZoneAttack): entity.destroy() for _z in range(2): - for i in range(8): + for i in range(10): projectiles = world.new_entity() projectiles.set( Sprite( - world[Assets].get_texture("error"), + world[Assets].get_texture("projectile"), Vec2( i * 41 + world[FightBox].p1[0] + (locate * 413), world[FightBox].p1[1], ), 2, ), + Animation("projectiles", 60, True), ZoneAttackProjectiles(), Hurt(10), TimedEvent(0.4, lambda world, entity: entity.destroy()),