diff options
| author | Chris Bradley <1029chris@gmail.com> | 2022-02-20 15:51:09 -0800 |
|---|---|---|
| committer | Chris Bradley <1029chris@gmail.com> | 2022-02-20 15:51:09 -0800 |
| commit | 995f96d8af37320da58733aeb4b2107af25ab668 (patch) | |
| tree | 1bc7670dccbfc99bbc34a1612a737cb64be0010a | |
| parent | a6097b11affbbd8c93c40bfc575bf25146c0c8fb (diff) | |
Turns out "\" is division + floor, thats cool! Saved a little tokens implementing it all over
| -rw-r--r-- | bullets.lua | 2 | ||||
| -rw-r--r-- | enemies.lua | 14 | ||||
| -rw-r--r-- | players.lua | 2 | ||||
| -rw-r--r-- | update.lua | 2 | ||||
| -rw-r--r-- | waves.lua | 2 |
5 files changed, 11 insertions, 11 deletions
diff --git a/bullets.lua b/bullets.lua index 5d050a2..6686a7e 100644 --- a/bullets.lua +++ b/bullets.lua @@ -128,7 +128,7 @@ function addmissile(x, y, target) --basic small weak enemy } function enemy.draw() - if enemy.inv < 0 or ceil(enemy.inv*10%2) == 1 then + if enemy.inv < 0 or flashtime then spr(12, enemy.x, enemy.y, 2, 1) end end diff --git a/enemies.lua b/enemies.lua index a7ccf90..faca5c1 100644 --- a/enemies.lua +++ b/enemies.lua @@ -390,18 +390,18 @@ function addwallboss(x, y, length, points, speed, stay, move, isboss) enemy.x -= speed else enemy.x = lerp(enemy.x, 102, 0.025) --lerp if boss - enemy.move = flr((currentwavetime/5)%5) -- loops through moveset + enemy.move = currentwavetime\5%5 -- loops through moveset end if enemy.shootcooldown < 0 then enemy.shootcooldown = 0.095 if enemy.x < canshootatx then local function attack(i, move) -- these are all the conditions to shoot depending on what "move" this guys on - if move == 0 and (flr((t()*4)%length) == i or flr((-t()*4)%length) == i) and i%2 == 1 then --this one shoots lines in a pattern + if move == 0 and (t()\0.25%length == i or -t()\0.25%length == i) and i%2 == 1 then --this one shoots lines in a pattern return true elseif move == 1 then -- this one targets the players and shoots some random ones for p = 1, #players, 1 do - if flr(players[p].y/8) == i-1 and everysecondtimer < 0.7 then + if players[p].y\8 == i-1 and everysecondtimer < 0.7 then return true end end @@ -532,7 +532,7 @@ function addmissileboss(x, y) --boss that shoots missiles!!! enemy.targetchangetimer -= ft --some cool different moves, shout out to dont get a virus fans! if currentwavetime%18 > 8 and currentwavetime%20 < 12 then - enemy.targety = flr(everysecondtimer*1.99)*96 + enemy.targety = everysecondtimer\0.501*96 elseif currentwavetime%18 > 17.3 then --INTIMIDATION TACTICS!!!!! enemy.targety = players[targetplayer].y enemy.targetx = players[targetplayer].x+24 @@ -677,12 +677,12 @@ function addfinalboss() --THE FINAL BOSS!!!!!!! WOOOAAAHHHHHH!!!!!!!!!!!!!!!!!!! end end } - moves[flr((currentwavetime/14)%#moves+1)]() + moves[(currentwavetime\14)%#moves+1]() end end enemydie(enemy,17,2,1000,true,1) --die!!!!!!! else - music(-1,1000) + playsong(-1,1000) killallenemies() despawnallbullets = true speed += 0.0003 @@ -697,7 +697,7 @@ function addfinalboss() --THE FINAL BOSS!!!!!!! WOOOAAAHHHHHH!!!!!!!!!!!!!!!!!!! sfx(21,3) end end - if dramaticdeathtimer < 0 then music(63,3) end --final big boom + if dramaticdeathtimer < 0 then playsong(63,3) end --final big boom enemymisc(enemy) end diff --git a/players.lua b/players.lua index bc5a095..4765096 100644 --- a/players.lua +++ b/players.lua @@ -55,7 +55,7 @@ function addplayer(x, y, sprite, spriteup, spritedwn, bulletsprite) sfx(11, 0) --killed sfx(22, 1) --rewind beat elseif player.health <= 0 then - currentscore = ceil(currentscore * 0.5) --halves score if coop + currentscore = currentscore \ 0.5 --halves score if coop sfx(11, 0) player.inv = 5 end @@ -1,6 +1,6 @@ respawntimer -= ft --similar math elements grouped to lower tokens -flashtime = ceil(t()*10%2) == 1 --for flashing elements (ship, score) +flashtime = t()\0.1%2 == 1 --for flashing elements (ship, score) circletimex = sin(t())*3 -- for elements that move in a circle (respawn timer) circletimey = cos(t())*3 screenshakex = sin(shake+t())*shake @@ -208,7 +208,7 @@ wave[15] = { delay = 0, start = function() for i = 1, 6, 1 do - addtargetingenemy(128, i*16-14+flr(i/4)*36, 0.05) + addtargetingenemy(128, i*16-14+i\4*36, 0.05) end addbomb(140,46, 1) end |
