diff options
| -rw-r--r-- | draw.lua | 23 | ||||
| -rw-r--r-- | enemies.lua | 24 | ||||
| -rw-r--r-- | ui.lua | 6 | ||||
| -rw-r--r-- | update.lua | 14 |
4 files changed, 43 insertions, 24 deletions
@@ -26,17 +26,26 @@ if gamerunning then print(ceil(players[2].inv), players[2].x+sin(t())*3, players[2].y+cos(t())*3, 9) end end -if not gamerunning or gt < 1 then +if not gamerunning or menuscroll < 1 then + menuscroll += scrollspeed + if not gamerunning then menushipscroll += 1/60 end for i = 1, 3, 1 do - spr(basicenemysprites[i%#basicenemysprites+1], (-t()*(i*20)+(sin(i/3+t()/100)*128)+1*8)%(128+1*8)-1*8-gt*180, i*36+sin(t()*i/3)*i*2-20,1,1) + spr(basicenemysprites[i%#basicenemysprites+1], (-menushipscroll*(i*20)+(sin(i/3)*128)+8)%(128+8)-1*8-menuscroll*240, i*36+sin(menushipscroll*i/3)*i*2-20-menuscroll*50,1,1) end - if t() < 0.68 then - drawlogo(24-gt*120,sin(0.25+t()*0.75)*26) + if t() < 1 then + drawlogo(24-menuscroll*120,19.5+sin(0.25+t()*0.5)*6.5) else - drawlogo(24-gt*120,26) + drawlogo(24-menuscroll*120,26) + end + mainmenutext(24-menuscroll*150,62) + credits(10-menuscroll*140,108) + if t() < 2 then + for i = 1, 128, 1 do + line(i-1,128,i-1,sin((i+0.22-t()*20)/24.357)*2+t()*80-10,11) --cool wavy transition effect!!!! + line(i-1,128,i-1,sin((i+t()*60)/44.357)*5+t()*80-5,3) + end + addcircle(rnd(128), t()*80, 0,rnd(1),rnd(12)+2,1.5,14,0) end - mainmenutext(24-gt*150,62) - credits(10-gt*140,100) end -- print(#obj)
\ No newline at end of file diff --git a/enemies.lua b/enemies.lua index 420146b..cead73c 100644 --- a/enemies.lua +++ b/enemies.lua @@ -37,7 +37,7 @@ function addbasicenemy(x, y, sprite, health, speed) end end - function enemy.collide(object) + function enemy.collide(object) --f this enemy collides with something, do damage to both it and itself. also EXPLODE!!! if enemy.x+4 >= object.x and enemy.x+4 <= object.x+object.w and enemy.y+4 >= object.y and enemy.y+4 <= object.y+object.h and object.inv < 0 then object:shot() explosion(enemy.x+4, enemy.y+4) @@ -53,13 +53,15 @@ function addbasicenemy(x, y, sprite, health, speed) foreach(players, enemy.collide) if enemy.shootcooldown < 0 then enemy.shootcooldown = 0.5 + rnd(1.5) - addbullet(enemy.x-3, enemy.y, -1, 0, true, 2) - sfx(15) + if enemy.x < 129 then + addbullet(enemy.x-3, enemy.y, -1, 0, true, 2) -- shoot if on screen + sfx(15) -- play shoot sound if on screen + end end if enemy.x < -8 then - del(enemies, enemy) + del(enemies, enemy) -- delete enemy if off screen end - if enemy.health <= 0 then + if enemy.health <= 0 then -- die!!!!! for i = 1, rnd(6)+6, 1 do addcircle(enemy.x+rnd(8), enemy.y+rnd(8), rnd(4)-2, -rnd(2)-1, 1, 2, rnd({3, 11, 9}), -0.1) end @@ -198,15 +200,17 @@ function addballshooter(x, y, health, speed) foreach(players, enemy.collide) if enemy.shootcooldown < 0 then enemy.shootcooldown = 2 - for i = 1, 48, 1 do - if sin(i/48) < 0.3 and sin((i+currentwavetime)/8) < 0.4 then - addbullet(enemy.x+4, enemy.y+4, sin(i/48)/2, cos(i/48)/2, true, 2) + if enemy.x < 129 then + for i = 1, 48, 1 do --shoot ring of bullets if on screen + if sin(i/48) < 0.3 and sin((i+currentwavetime)/8) < 0.4 then + addbullet(enemy.x+4, enemy.y+4, sin(i/48)/2, cos(i/48)/2, true, 2) + end end + sfx(19) -- play shoot sound end - sfx(19) end if enemy.x < -32 then - del(enemies, enemy) + del(enemies, enemy) --delete enemy if off screen end if enemy.health < 8 then --smokes when damaged! addcircle(enemy.x+20+rnd(8), enemy.y+4+rnd(8), -0.5, -0.2, rnd(8), rnd(1)+0.7, 5, 0) @@ -1,3 +1,5 @@ +menuscroll = 0 +menushipscroll = 0 function drawlogo(x,y) --default values -- x = 24 @@ -70,8 +72,8 @@ function credits(x,y) print("1029chris ribboncable", x+9,y+5,9) print("code/tunes art/sounds", x+8,y+13,0) print("code/tunes art/sounds", x+8,y+12,9) - print("made in vancouver - 2022", x+6,y+22,0) - print("made in vancouver - 2022", x+6,y+21,4) + -- print("made in vancouver - 2022", x+6,y+22,0) + -- print("made in vancouver - 2022", x+6,y+21,4) end @@ -1,20 +1,20 @@ --scrolling and respawn stuff respawntimer -= 1/60 if gameover then - scrollspeed = mid(-1/60,scrollspeed-1/6000,1/60) + -- sfx(1, 1, 0, 28) + scrollspeed = mid(-1/10,scrollspeed-1/3000,1/60) if respawntimer < 0 then gameover = false foreach(players, function(obj) obj:respawn() end) setwave(mid(1,currentwave-2,#wave)) end elseif gamerunning then - updatewaves() - updateobjs() + updatewaves() -- update the wave function scrollspeed = mid(0,scrollspeed+1/2000,1/60) end -gt += scrollspeed +gt += scrollspeed + 1/600 -if not gamerunning then +if not gamerunning and t() > 1 then if btn(4) then addplayer(18, 60, 16, 18) startgame() @@ -25,6 +25,10 @@ if not gamerunning then end end +if gamerunning or t() < 1.95 then -- weird if because of freezing bubbles in the menu + updateobjs() --update all objects +end + --screenshake math shake = shake + 0.11 * (0 - shake); if shake < 1 then |
