Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --bullet_chaserorb
- -- The chasing attack that everyone knows
- --Setting up the stage
- bg = CreateProjectileAbs("bg_filled", 320, 240)
- monster = CreateProjectile("poseur", 0, 186)
- fakearena = CreateProjectile("arena", 0, 0)
- fakeheart = CreateProjectile("cyanheart", 0, 0)
- --Creating the chasers
- realbullet = CreateProjectile('realbullet', -Arena.width/2, -Arena.height/2) --realbullet.png is just an empty image
- realbullet.SetVar('xspeed', 0)
- realbullet.SetVar('yspeed', 0)
- realbullet.SetVar('real', true) --important for OnHit
- fakebullet = CreateProjectile('bullet', Arena.width/2, Arena.height/2)
- function Update()
- fakearena.MoveTo(Player.x, Player.y) --the "arena" that you control follows the actual heart's movements
- local xdifference = Player.x - realbullet.x
- local ydifference = Player.y - realbullet.y
- local xspeed = realbullet.GetVar('xspeed') / 2 + xdifference / 100
- local yspeed = realbullet.GetVar('yspeed') / 2 + ydifference / 100
- realbullet.Move(xspeed, yspeed)
- realbullet.SetVar('xspeed', xspeed)
- realbullet.SetVar('yspeed', yspeed)
- fakebullet.MoveTo(fakearena.x - realbullet.x, fakearena.y - realbullet.y) --move the visible chaser to mirror the painful one
- end
- function OnHit(bullet) --important so the stage doesn't kill you
- if bullet.GetVar('real') then
- Player.Hurt(5, 0.5)
- end
- end
- --------------------------------------------------------------------------------------------------------------------------------
- --bullet_zoning
- --Setting up the stage
- bg = CreateProjectileAbs("bg_filled", 320, 240)
- monster = CreateProjectile("poseur", 0, 186)
- fakearena = CreateProjectile("arena", 0, 0)
- fakeheart = CreateProjectile("cyanheart", 0, 0)
- timer = -15 --Set up a timer
- num = 0
- area = 0
- warned = false --conditionals set-up
- zoned = false
- function Update()
- fakearena.MoveTo(Player.x, Player.y) --moving the "arena" around
- timer = timer + 1 --increment timer
- if timer < 30 then
- if not warned then
- num = math.random() --randomly choose zone
- if num < 0.333 then
- warning = CreateProjectile("warning", fakearena.x - Arena.width/3, fakearena.y)
- area = 1
- elseif num < 0.666 then
- warning = CreateProjectile("warning", fakearena.x, fakearena.y)
- area = 2
- else
- warning = CreateProjectile("warning", fakearena.x + Arena.width/3, fakearena.y)
- area = 3
- end
- warned = true --conditional so only one warning is made
- end
- warning.MoveTo(fakearena.x + (2 - area)*Arena.width/3, fakearena.y) --warning moves with "arena"
- elseif timer < 60 then
- if warned then --removing the warning
- warning.Remove()
- warned = false
- end
- if not zoned then --making the hurtbox
- if area == 1 then
- badzone = CreateProjectile("badzone", fakearena.x - Arena.width/3, fakearena.y)
- realbadzone = CreateProjectile("realbadzone", -Arena.width/3, 0)
- elseif area == 2 then
- badzone = CreateProjectile("badzone", fakearena.x, fakearena.y)
- realbadzone = CreateProjectile("realbadzone", 0, 0)
- else
- badzone = CreateProjectile("badzone", fakearena.x + Arena.width/3, fakearena.y)
- realbadzone = CreateProjectile("realbadzone", Arena.width/3, 0)
- end
- zoned = true --same conditional for the zones
- end
- realbadzone.SetVar('real', true) --Hurtbox now hurts
- badzone.MoveTo(fakearena.x + (2 - area)*Arena.width/3, fakearena.y) --moving the fake zone
- else
- if zoned then --removing the zones
- badzone.Remove()
- realbadzone.Remove()
- end
- zoned = false
- timer = -15 --a brief respite
- end
- end
- function OnHit(bullet)
- if bullet.GetVar('real') then
- Player.Hurt(1, 0.1) --ouchies
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement