Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function _init()
- frame = 0
- boss = create_enemy(nil, STAGE_CENTER_X, STAGE_TOP + 40)
- boss:set_movement_decelerating(STAGE_CENTER_X, STAGE_TOP + 120, 90)
- count = 0
- bangle = 0
- distance_x = 90
- distance_y = 90
- end
- function _update()
- count = count + 1
- if(count == 30) then
- count = 0
- end
- if(frame % 360 >= 90 and frame % 2 == 1) then -- shoots leaves
- leaf = create_bullet(1000, boss.x + distance_x * maths.sin(PI * count / 15), boss.y + distance_y * maths.cos(PI * (count / 15)), { colour1 = { 0.0, 1.0, 0.0 }, angle = bangle, velocity = 1})
- bangle = bangle + PI / 1.3495
- distance_x = distance_x - 1
- distance_y = distance_y - 1
- end
- if(frame % 360 == 30 and frame > 30) then -- shoots aimeds
- for j = 1, 5, 1 do
- for i = 1, 9, 1 do
- local aimed = create_bullet(0, boss.x, boss.y, {velocity = 0.5, acceleration = 0.001 * j, colour2 = { 0.0, 0.0, 1.0 }})
- aimed:set_angle_to(player_x(), player_y())
- aimed.angle = aimed.angle + (i * 0.07 * PI) - 0.35 * PI
- end
- end
- end
- if(frame > 0 and frame % 360 == 0) then -- boss moves, shit resets
- move()
- distance_x = 90
- distance_y = 90
- end
- frame = frame + 1
- end
- function move()
- local left = STAGE_LEFT + 48.0
- local right = STAGE_RIGHT - 48.0
- local top = STAGE_TOP + 96.0
- local bottom = STAGE_TOP + 150.0
- local xd = random(40.0, 80.0)
- local yd = random(-40.0, 40.0)
- local x;
- if(player_x() < boss.x) then
- x = boss.x - xd
- else
- x = boss.x + xd
- end
- if(x < left) then
- x = boss.x + xd
- elseif(x > right) then
- x = boss.x - xd
- end
- local y = boss.y + yd
- if(y < top) then
- y = top
- elseif(y > bottom) then
- y = bottom
- end
- boss:set_movement_decelerating(x, y, 90)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement