Skip to content

Commit

Permalink
adjust bullet to use bomb logic
Browse files Browse the repository at this point in the history
- falls slow at start, then falls fast and explodes when hits ground
  • Loading branch information
TheAfroOfDoom committed Jan 13, 2024
1 parent d9779f9 commit 1e3e74b
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@
scoreboard players set @s attack.clock.i -1
scoreboard players operation @s attack.speed.z = #attack-bomb attack.speed.z

# Play bullet shoot sound
playsound omega-flowey:attack.bomb.shoot hostile @a ~ ~ ~ 5 1

# Set pitch and yaw from input
execute store result entity @s Rotation[0] float 0.01 run data get storage attack:bomb yaw
execute store result entity @s Rotation[1] float 0.01 run data get storage attack:bomb pitch
# Play summon animation (scale-in from 0)
function animated_java:bomb/animations/summon/play

# Remove tags
tag @s remove attack-bullet-new
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
scoreboard players add @s attack.clock.i 1

data merge storage utils:damage { damage: 2, radius: 1 }
execute positioned ~ ~-1.5 ~ run function entity:utils/damage with storage utils:damage
# this is a rect volume, size is 18x(28+36)x18
# y-bound is -28 to +36
data merge storage utils:damage { damage: 2, radius: 1.8 }
exeute positioned ~ ~-2 ~ run function entity:utils/damage with storage utils:damage
exeute positioned ~ ~ ~ run function entity:utils/damage with storage utils:damage
exeute positioned ~ ~2 ~ run function entity:utils/damage with storage utils:damage

# Move forward
function entity:hostile/omega-flowey/attack/bomb/bullet/loop/move
# Move down slowly during summon animation
execute if score @s attack.clock.i matches 0..15 run teleport @s ~ ~-0.5 ~

# TODO(60): validate/determine a value for how long until the bomb bullets terminate
# Play falling sound once when we start falling faster
execute if score @s attack.clock.i matches 20 run function entity:hostile/omega-flowey/attack/bomb/bullet/loop/start_falling

# Move down faster during actual fall after a delay
execute if score @s attack.clock.i matches 20.. run teleport @s ~ ~-2.2 ~

# Stop falling after bomb falls through floor
execute at @s if entity @s[x=-100,dx=200,y=33,dy=-20,z=-100,dz=200] run function entity:hostile/omega-flowey/attack/bomb/bullet/loop/stop_falling

# TODO(): validate/determine a value for how long until the bomb bullets terminate
# Terminate after X seconds
execute if score @s attack.clock.i matches 60.. run function entity:hostile/omega-flowey/attack/bomb/bullet/terminate
execute if score @s attack.clock.i matches 39.. run function entity:hostile/omega-flowey/attack/bomb/bullet/terminate

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
stopsound @a hostile omega-flowey:attack.bomb.fall
playsound omega-flowey:attack.bomb.fall hostile @a ~ ~ ~ 5 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Keep consistent y-pos
teleport @s ~ 33.0 ~

# Play animation if we just stopped falling
execute unless entity @s[tag=is_done_falling] run function animated_java:bomb/animations/explode/play
execute unless entity @s[tag=is_done_falling] run stopsound @a hostile omega-flowey:attack.bomb.explode
execute unless entity @s[tag=is_done_falling] run playsound omega-flowey:attack.bomb.explode hostile @a ~ ~ ~ 5 1

# Add tags
tag @s add is_done_falling

0 comments on commit 1e3e74b

Please sign in to comment.