Commit ca0e821241454049d192d74caab35ae995b6ddbd

Authored by Geoffrey PREUD'HOMME
0 parents

Code original

asteroid.lua 0 → 100644
  1 +++ a/asteroid.lua
... ... @@ -0,0 +1,84 @@
  1 +asteroid = class:new()
  2 +
  3 +function asteroid:init(x, y, size)
  4 + self.x = x or math.random(80)+10
  5 + self.y = y or -10
  6 + self.r = math.random(math.pi*20)/10
  7 + self.size = size or 1
  8 + self.rspeed = (math.random()*2-1)*10
  9 + self.speedx = math.random(5)+20
  10 + self.speedy = math.random(5)+10
  11 + self.i = math.random(2)
  12 + self.direction = math.random(2)
  13 + if self.direction == 2 then
  14 + self.direction = -1
  15 + end
  16 +
  17 + if self.size == 1 then
  18 + self.hp = 12*realasteroiddelay
  19 + else
  20 + self.hp = 6*realasteroiddelay
  21 + end
  22 +end
  23 +
  24 +function asteroid:update(dt)
  25 + self.x = self.x + self.speedx*dt*self.direction
  26 + self.y = self.y + self.speedy*dt
  27 +
  28 + if self.x > 90 then
  29 + self.direction = -1
  30 + elseif self.x < 10 then
  31 + self.direction = 1
  32 + end
  33 +
  34 + if self.y > 40 then
  35 + self.speedy = 100
  36 + self.direction = 0
  37 + end
  38 +
  39 + self.r = self.r + self.rspeed*dt
  40 +
  41 + if self.y > 120 then
  42 + self.dead = true
  43 + end
  44 +
  45 + return self.dead
  46 +end
  47 +
  48 +function asteroid:hit()
  49 + self.hp = self.hp - 1
  50 + if self.hp <= 0 then
  51 + if self.size == 1 then
  52 + table.insert(asteroids, asteroid:new(self.x, self.y, 2))
  53 + table.insert(asteroids, asteroid:new(self.x, self.y, 2))
  54 + pointsget(10)
  55 + else
  56 + pointsget(10)
  57 + end
  58 + lastexplosion = {self.x, self.y}
  59 + self.dead = true
  60 + table.insert(explosions, explosion:new(self.x-12, self.y-16))
  61 + backgroundwhite = 1
  62 + end
  63 +end
  64 +
  65 +function asteroid:checkcol(x, y)
  66 + if self.size == 1 then --big
  67 + if math.abs(self.x-x) < 9 and math.abs(self.y-y) < 9 then
  68 + return true
  69 + end
  70 + else
  71 + if math.abs(self.x-x) < 6 and math.abs(self.y-y) < 6 then
  72 + return true
  73 + end
  74 + end
  75 + return false
  76 +end
  77 +
  78 +function asteroid:draw()
  79 + if self.size == 1 then
  80 + draw(_G["asteroid-big" .. self.i .. "img"], self.x, self.y, self.r, 1, 1, 11, 9)
  81 + else
  82 + draw(_G["asteroid-small" .. self.i .. "img"], self.x, self.y, self.r, 1, 1, 11, 9)
  83 + end
  84 +end
0 85 \ No newline at end of file
... ...
audio/approach.ogg 0 → 100644
No preview for this file type
audio/bigexplosion.ogg 0 → 100644
No preview for this file type
audio/credits.ogg 0 → 100644
No preview for this file type
audio/ding.ogg 0 → 100644
No preview for this file type
audio/explosion.wav 0 → 100644
No preview for this file type
audio/gunfire.wav 0 → 100644
No preview for this file type
audio/laser.wav 0 → 100644
No preview for this file type
audio/launch.ogg 0 → 100644
No preview for this file type
audio/space.ogg 0 → 100644
No preview for this file type
audio/space.wav 0 → 100644
No preview for this file type
audio/splat.ogg 0 → 100644
No preview for this file type
audio/sunglasses.ogg 0 → 100644
No preview for this file type
audio/trosong.ogg 0 → 100644
No preview for this file type
bigexplosion.lua 0 → 100644
  1 +++ a/bigexplosion.lua
... ... @@ -0,0 +1,30 @@
  1 +bigexplosion = class:new()
  2 +
  3 +function bigexplosion:init(x, y)
  4 + self.x = x
  5 + self.y = y
  6 + self.quad = 1
  7 + self.quadtimer = 0
  8 +end
  9 +
  10 +function bigexplosion:update(dt)
  11 + self.quadtimer = self.quadtimer + dt*3
  12 + while self.quadtimer > 1 do
  13 + self.quadtimer = self.quadtimer - 1
  14 + self.quad = self.quad + 1
  15 + if self.quad == 26 then
  16 + return true
  17 + end
  18 + end
  19 +end
  20 +
  21 +function bigexplosion:draw()
  22 + local r, g, b = love.graphics.getColor()
  23 + if starttimer > 0 then
  24 + love.graphics.setColor(255, 255, 255, 255*math.min(1, math.max(0, (1-starttimer/7))))
  25 + end
  26 + if self.quad <= 25 then
  27 + love.graphics.drawq(bigexplosionimg, bigexplosionquad[self.quad], self.x*scale, self.y*scale, 0, scale, scale)
  28 + end
  29 + love.graphics.setColor(r, g, b)
  30 +end
0 31 \ No newline at end of file
... ...
bird.lua 0 → 100644
  1 +++ a/bird.lua
... ... @@ -0,0 +1,52 @@
  1 +bird = class:new()
  2 +
  3 +function bird:init(x, y)
  4 + self.x = math.random(100)
  5 + self.y = 90
  6 + self.quad = 1
  7 + self.quadtimer = 0
  8 + self.speedx = (math.random()*2-1)*50
  9 + self.speedy = math.random(30)+10
  10 +
  11 + self.dir = math.random(2)
  12 + if self.dir == 2 then
  13 + self.dir = -1
  14 + end
  15 +end
  16 +
  17 +function bird:update(dt)
  18 + self.quadtimer = self.quadtimer + dt*5
  19 + if self.quadtimer > 1 then
  20 + self.quadtimer = self.quadtimer - 1
  21 + if self.quad == 1 then
  22 + self.quad = 2
  23 + else
  24 + self.quad = 1
  25 + end
  26 + end
  27 +
  28 + self.x = self.x + self.speedx*dt*self.dir
  29 + self.y = self.y - self.speedy*dt
  30 +
  31 + if self.x > 100 then
  32 + self.dir = -1
  33 + elseif self.x < 0 then
  34 + self.dir = 1
  35 + end
  36 +
  37 + if self.y < -10 or self.dead then
  38 + return true
  39 + end
  40 +end
  41 +
  42 +function bird:checkcol(x, y)
  43 + if math.abs(self.x-x) < 7 and math.abs(self.y-y) < 4 then
  44 + self.dead = true
  45 + return true
  46 + end
  47 + return false
  48 +end
  49 +
  50 +function bird:draw()
  51 + love.graphics.drawq(birdimg, birdquad[self.quad], self.x*scale, self.y*scale, 0, scale/2, scale/2, 14, 8)
  52 +end
0 53 \ No newline at end of file
... ...
bullet.lua 0 → 100644
  1 +++ a/bullet.lua
... ... @@ -0,0 +1,41 @@
  1 +bullet = class:new()
  2 +
  3 +function bullet:init(x, y, r)
  4 + self.x = x
  5 + self.y = y
  6 + self.r = r
  7 + gunfire:stop()
  8 + gunfire:play()
  9 +end
  10 +
  11 +function bullet:update(dt)
  12 + if not self.kill then
  13 + self.x = self.x + math.sin(self.r)*500*dt
  14 + self.y = self.y - math.cos(self.r)*300*dt
  15 +
  16 + for i, v in pairs(asteroids) do
  17 + if v:checkcol(self.x, self.y) and not v.dead then
  18 + v:hit()
  19 + self.kill = 0
  20 + end
  21 + end
  22 + end
  23 +
  24 + if self.kill then
  25 + self.kill = self.kill + dt
  26 + end
  27 +
  28 + if self.kill and self.kill >= 0.2 then
  29 + return true
  30 + end
  31 +end
  32 +
  33 +function bullet:draw()
  34 + if self.kill then
  35 + love.graphics.setColor(255, 255, 255, (1-self.kill/0.2)*255)
  36 + draw(littleexplosionimg, self.x, self.y, self.r, 1, 1, 8, 4)
  37 + love.graphics.setColor(255, 255, 255, 255)
  38 + else
  39 + draw(bulletimg, self.x, self.y, self.r, 1, 1, 6, 4)
  40 + end
  41 +end
0 42 \ No newline at end of file
... ...
bush.lua 0 → 100644
  1 +++ a/bush.lua
... ... @@ -0,0 +1,25 @@
  1 +bush = class:new()
  2 +
  3 +function bush:init()
  4 + self.x = math.random()*100
  5 + self.y = math.random()*20+57
  6 + self.i = math.random(2)
  7 + self.speed = 50
  8 +end
  9 +
  10 +function bush:update(dt)
  11 + if not rockets or rockets[1].x > 50 then
  12 + self.x = self.x - self.speed*dt
  13 + end
  14 +
  15 + if self.x < - _G["bush" .. self.i .. "img"]:getWidth() then
  16 + self.x = 100
  17 + self.y = math.random()*20+57
  18 + self.i = math.random(2)
  19 + self.speed = 50
  20 + end
  21 +end
  22 +
  23 +function bush:draw()
  24 + draw(_G["bush" .. self.i .. "img"], self.x, self.y)
  25 +end
0 26 \ No newline at end of file
... ...
class.lua 0 → 100644
  1 +++ a/class.lua
... ... @@ -0,0 +1,44 @@
  1 +--[[
  2 +Copyright (c) 2009 Bart van Strien
  3 +
  4 +Permission is hereby granted, free of charge, to any person
  5 +obtaining a copy of this software and associated documentation
  6 +files (the "Software"), to deal in the Software without
  7 +restriction, including without limitation the rights to use,
  8 +copy, modify, merge, publish, distribute, sublicense, and/or sell
  9 +copies of the Software, and to permit persons to whom the
  10 +Software is furnished to do so, subject to the following
  11 +conditions:
  12 +
  13 +The above copyright notice and this permission notice shall be
  14 +included in all copies or substantial portions of the Software.
  15 +
  16 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  17 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  18 +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  19 +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  20 +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  21 +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  22 +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  23 +OTHER DEALINGS IN THE SOFTWARE.
  24 +]]
  25 +
  26 +__HAS_SECS_COMPATIBLE_CLASSES__ = true
  27 +
  28 +local class_mt = {}
  29 +
  30 +function class_mt:__index(key)
  31 + return self.__baseclass[key]
  32 +end
  33 +
  34 +class = setmetatable({ __baseclass = {} }, class_mt)
  35 +
  36 +function class:new(...)
  37 + local c = {}
  38 + c.__baseclass = self
  39 + setmetatable(c, getmetatable(self))
  40 + if c.init then
  41 + c:init(...)
  42 + end
  43 + return c
  44 +end
0 45 \ No newline at end of file
... ...
cloud.lua 0 → 100644
  1 +++ a/cloud.lua
... ... @@ -0,0 +1,30 @@
  1 +cloud = class:new()
  2 +
  3 +function cloud:init(random, y)
  4 + if y then
  5 + self.starty = y
  6 + end
  7 + self.x = math.random()*100
  8 + self.y = y or math.random()*20+3
  9 + self.i = math.random(2)
  10 + self.speed = math.random()*20+50
  11 +end
  12 +
  13 +function cloud:update(dt)
  14 + if not rockets or rockets[1].x > 50 then
  15 + self.x = self.x - self.speed*dt
  16 + else
  17 + self.x = self.x - self.speed*0.3*dt
  18 + end
  19 +
  20 + if self.x < - _G["cloud" .. self.i .. "img"]:getWidth() then
  21 + self.x = 100
  22 + self.y = self.starty or math.random()*20+3
  23 + self.i = math.random(2)
  24 + self.speed = math.random()*20+50
  25 + end
  26 +end
  27 +
  28 +function cloud:draw()
  29 + draw(_G["cloud" .. self.i .. "img"], self.x, self.y)
  30 +end
0 31 \ No newline at end of file
... ...
cloud2.lua 0 → 100644
  1 +++ a/cloud2.lua
... ... @@ -0,0 +1,22 @@
  1 +cloud2 = class:new()
  2 +
  3 +function cloud2:init(y)
  4 + self.x = math.random()*100
  5 + self.y = 120+y
  6 + self.i = math.random(2)
  7 + self.speed = -500
  8 +end
  9 +
  10 +function cloud2:update(dt)
  11 + self.y = self.y + self.speed*dt
  12 +
  13 + if self.y < -20 then
  14 + self.y = self.y+140
  15 + self.x = math.random()*100
  16 + self.i = math.random(2)
  17 + end
  18 +end
  19 +
  20 +function cloud2:draw()
  21 + draw(_G["cloud" .. self.i .. "img"], self.x, self.y, 0, 1, 1, 15)
  22 +end
0 23 \ No newline at end of file
... ...
conf.lua 0 → 100644
  1 +++ a/conf.lua
... ... @@ -0,0 +1,9 @@
  1 +function love.conf(t)
  2 + t.title = "TROSH: The Movie: The Game"
  3 + t.author = "Maurice"
  4 + t.console = false
  5 + t.screen.vsync = true
  6 + t.screen.width = 800
  7 + t.screen.height = 640
  8 + t.screen.fsaa = 0
  9 +end
0 10 \ No newline at end of file
... ...
enemy.lua 0 → 100644
  1 +++ a/enemy.lua
... ... @@ -0,0 +1,64 @@
  1 +enemy = class:new()
  2 +
  3 +function enemy:init()
  4 + self.quad = 1
  5 + self.x = 100
  6 + self.y = math.random()*20+40
  7 + self.quadtimer = 0
  8 + self.movement = math.random(7)-4
  9 + if self.movement > 0 then
  10 + self.movement = 1
  11 + elseif self.movement < 0 then
  12 + self.movement = -1
  13 + end
  14 + self.speed = math.random(30)+40
  15 + self.dead = false
  16 +end
  17 +
  18 +function enemy:update(dt)
  19 + self.quadtimer = self.quadtimer + dt*30
  20 + if self.quadtimer > 1 then
  21 + self.quadtimer = self.quadtimer - 1
  22 + self.quad = self.quad + 1
  23 + if self.quad == 17 then
  24 + self.quad = 1
  25 + end
  26 + end
  27 +
  28 + if self.movement == 1 then
  29 + self.y = self.y - dt*30
  30 + if self.y < 40 then
  31 + self.movement = -1
  32 + end
  33 + elseif self.movement == -1 then
  34 + self.y = self.y + dt*30
  35 + if self.y > 70 then
  36 + self.movement = 1
  37 + end
  38 + end
  39 +
  40 + self.x = self.x - self.speed*dt
  41 +
  42 + if self.dead then
  43 + return true
  44 + end
  45 +end
  46 +
  47 +function enemy:explode()
  48 + self.dead = true
  49 + table.insert(explosions, explosion:new(self.x-5, self.y-10))
  50 + pointsget(1)
  51 + skycolor = getrainbowcolor(math.random())
  52 + love.graphics.setBackgroundColor(skycolor)
  53 +end
  54 +
  55 +function enemy:checkcol(x, y, newx)
  56 + if x < self.x+4 and newx > self.x+4 and math.abs(self.y+7-y) < 6 then
  57 + return true
  58 + end
  59 + return false
  60 +end
  61 +
  62 +function enemy:draw()
  63 + love.graphics.drawq(enemyimg, enemyquad[self.quad], self.x*scale, self.y*scale, 0, 0.1875*scale, 0.1875*scale)
  64 +end
0 65 \ No newline at end of file
... ...
explosion.lua 0 → 100644
  1 +++ a/explosion.lua
... ... @@ -0,0 +1,25 @@
  1 +explosion = class:new()
  2 +
  3 +function explosion:init(x, y)
  4 + self.x = x
  5 + self.y = y
  6 + self.quad = 1
  7 + self.quadtimer = 0
  8 + explosionsound:stop()
  9 + explosionsound:play()
  10 +end
  11 +
  12 +function explosion:update(dt)
  13 + self.quadtimer = self.quadtimer + dt*60
  14 + if self.quadtimer > 1 then
  15 + self.quadtimer = self.quadtimer - 1
  16 + self.quad = self.quad + 1
  17 + if self.quad == 26 then
  18 + return true
  19 + end
  20 + end
  21 +end
  22 +
  23 +function explosion:draw()
  24 + love.graphics.drawq(explosionimg, explosionquad[self.quad], self.x*scale, self.y*scale, 0, 0.375*scale, 0.375*scale)
  25 +end
0 26 \ No newline at end of file
... ...
graphics/alert.png 0 → 100644

2.04 KB

graphics/arrow.png 0 → 100644

262 Bytes

graphics/asteroid-big1.png 0 → 100644

2.88 KB

graphics/asteroid-big2.png 0 → 100644

2.92 KB

graphics/asteroid-small1.png 0 → 100644

2.84 KB

graphics/asteroid-small2.png 0 → 100644

2.86 KB

graphics/awesome.png 0 → 100644

747 Bytes

graphics/bigexplosion.png 0 → 100644

61.8 KB

graphics/bird.png 0 → 100644

417 Bytes

graphics/bullet.png 0 → 100644

407 Bytes

graphics/bush1.png 0 → 100644

224 Bytes

graphics/bush2.png 0 → 100644

213 Bytes

graphics/cloud1.png 0 → 100644

280 Bytes

graphics/cloud2.png 0 → 100644

252 Bytes

graphics/enemy.png 0 → 100644

5.36 KB

graphics/explosion.png 0 → 100644

20.7 KB

graphics/font.png 0 → 100644

796 Bytes

graphics/ground.png 0 → 100644

330 Bytes

graphics/groundwin.png 0 → 100644

799 Bytes

graphics/icon.png 0 → 100644

242 Bytes

graphics/littleexplosion.png 0 → 100644

440 Bytes

graphics/powerup.png 0 → 100644

252 Bytes

graphics/randomshit.png 0 → 100644

4.86 KB

graphics/rocket.png 0 → 100644

417 Bytes

graphics/rocketkaputt.png 0 → 100644

478 Bytes

graphics/splatter.png 0 → 100644

421 Bytes

graphics/star.png 0 → 100644

334 Bytes

graphics/sunglasses.png 0 → 100644

158 Bytes

graphics/title.png 0 → 100644

683 Bytes

graphics/trosh.png 0 → 100644

642 Bytes

graphics/troshwin.png 0 → 100644

488 Bytes

graphics/warning.png 0 → 100644

1.66 KB

graphics/wheatley.png 0 → 100644

691 Bytes

laser.lua 0 → 100644
  1 +++ a/laser.lua
... ... @@ -0,0 +1,29 @@
  1 +laser = class:new()
  2 +
  3 +function laser:init(x, y)
  4 + self.i = 0
  5 + self.x = x
  6 + self.y = y
  7 +end
  8 +
  9 +function laser:update(dt)
  10 + local oldi = self.i
  11 + self.i = self.i + dt*5
  12 +
  13 + if self.i > 1 then
  14 + return true
  15 + end
  16 +
  17 + if enemies then
  18 + for i, v in pairs(enemies) do
  19 + if v:checkcol(self.x + oldi*100, self.y, self.x + self.i*100) then
  20 + v:explode()
  21 + end
  22 + end
  23 + end
  24 +end
  25 +
  26 +function laser:draw()
  27 + love.graphics.setColor(getrainbowcolor(math.random(), 400))
  28 + love.graphics.rectangle("fill", self.x*scale, self.y*scale, 100*scale*self.i, scale*2)
  29 +end
0 30 \ No newline at end of file
... ...
main.lua 0 → 100644
  1 +++ a/main.lua
... ... @@ -0,0 +1,316 @@
  1 +function love.load()
  2 + love.graphics.setDefaultImageFilter("nearest", "nearest")
  3 +
  4 + require "class"
  5 + require "menu"
  6 + require "cloud"
  7 + require "cloud2"
  8 + require "bush"
  9 + require "scene1"
  10 + require "scene2"
  11 + require "scene3"
  12 + require "scene4"
  13 + require "scene5"
  14 + require "scene6"
  15 + require "laser"
  16 + require "enemy"
  17 + require "explosion"
  18 + require "bigexplosion"
  19 + require "splatter"
  20 + require "powerup"
  21 + require "rocket"
  22 + require "star"
  23 + require "asteroid"
  24 + require "bullet"
  25 + require "bird"
  26 +
  27 + love.graphics.setIcon( love.graphics.newImage("graphics/icon.png") )
  28 + imagelist = {"title", "cloud1", "cloud2", "ground", "bush1", "bush2", "powerup", "rocket", "star", "asteroid-big1", "sunglasses", "awesome", "arrow", "groundwin",
  29 + "asteroid-big2", "asteroid-small1", "asteroid-small2", "bullet", "littleexplosion", "warning", "wheatley", "alert", "randomshit", "bird"}
  30 +
  31 + for i = 1, #imagelist do
  32 + _G[imagelist[i] .. "img"] = love.graphics.newImage("graphics/" .. imagelist[i] .. ".png")
  33 + end
  34 +
  35 + fontimage = love.graphics.newImage("graphics/font.png")
  36 +
  37 + fontglyphs = "0123456789abcdefghijklmnopqrstuvwxyz.:/,'C-_>* !{}?"
  38 + fontquads = {}
  39 + for i = 1, string.len(fontglyphs) do
  40 + fontquads[string.sub(fontglyphs, i, i)] = love.graphics.newQuad((i-1)*8, 0, 8, 8, 408, 8)
  41 + end
  42 +
  43 + playerimg = love.graphics.newImage("graphics/trosh.png")
  44 + playerquad = {love.graphics.newQuad(0, 0, 14, 25, 54, 25), love.graphics.newQuad(14, 0, 14, 25, 54, 25), love.graphics.newQuad(28, 0, 26, 12, 54, 25), love.graphics.newQuad(28, 12, 26, 12, 54, 25)}
  45 +
  46 + winplayerimg = love.graphics.newImage("graphics/troshwin.png")
  47 + winplayerquad = {}
  48 + for x = 1, 4 do
  49 + winplayerquad[x] = love.graphics.newQuad((x-1)*11, 0, 11, 26, 44, 26)
  50 + end
  51 +
  52 + enemyimg = love.graphics.newImage("graphics/enemy.png")
  53 + enemyquad = {}
  54 + for y = 1, 4 do
  55 + for x = 1, 4 do
  56 + enemyquad[(y-1)*4+x] = love.graphics.newQuad((x-1)*100, (y-1)*96, 100, 96, 400, 384)
  57 + end
  58 + end
  59 +
  60 + explosionimg = love.graphics.newImage("graphics/explosion.png")
  61 + explosionquad = {}
  62 + for y = 1, 5 do
  63 + for x = 1, 5 do
  64 + explosionquad[(y-1)*5+x] = love.graphics.newQuad((x-1)*66, (y-1)*81, 66, 81, 330, 405)
  65 + end
  66 + end
  67 +
  68 + bigexplosionimg = love.graphics.newImage("graphics/bigexplosion.png")
  69 + bigexplosionquad = {}
  70 + for y = 1, 5 do
  71 + for x = 1, 5 do
  72 + bigexplosionquad[(y-1)*5+x] = love.graphics.newQuad((x-1)*108, (y-1)*121, 108, 121, 540, 605)
  73 + end
  74 + end
  75 +
  76 + splatterimg = love.graphics.newImage("graphics/splatter.png")
  77 + splatterquad = {}
  78 + for x = 1, 6 do
  79 + splatterquad[x] = love.graphics.newQuad((x-1)*64, 0, 64, 64, 384, 64)
  80 + end
  81 +
  82 + birdquad = {love.graphics.newQuad(0, 0, 29, 16, 29, 32), love.graphics.newQuad(0, 16, 29, 16, 29, 32)}
  83 +
  84 + scale = 8
  85 + local w, h = love.graphics.getMode()
  86 + if w ~= 100*scale or h ~= 80*scale then
  87 + love.graphics.setMode(100*scale, 80*scale, false, true, 0)
  88 + end
  89 + love.graphics.setIcon( love.graphics.newImage("graphics/icon.png") )
  90 +
  91 + bgmusic = love.audio.newSource("audio/trosong.ogg")
  92 + bgmusic:setLooping(true)
  93 + lasersound = love.audio.newSource("audio/laser.wav")
  94 + bigexplosionsound = love.audio.newSource("audio/bigexplosion.ogg")
  95 + explosionsound = love.audio.newSource("audio/explosion.wav")
  96 + launchsound = love.audio.newSource("audio/launch.ogg")
  97 + gunfire = love.audio.newSource("audio/gunfire.wav")
  98 + space = love.audio.newSource("audio/space.ogg")
  99 + sunglassessound = love.audio.newSource("audio/sunglasses.ogg")
  100 + splat = love.audio.newSource("audio/splat.ogg")
  101 + ding = love.audio.newSource("audio/ding.ogg")
  102 + credits = love.audio.newSource("audio/credits.ogg")
  103 + approach = love.audio.newSource("audio/approach.ogg")
  104 + credits:setLooping(true)
  105 +
  106 + skipupdate = true
  107 + shakeamount = 0
  108 + shake = 0
  109 + fade = 0
  110 + playerframe = 1
  111 + scoreanim = 1
  112 + rainbowi = 0.5
  113 + sini = 0
  114 + sini2 = math.pi/2
  115 + scrollx = 0
  116 + points = 0
  117 + machinedelay = 0.05
  118 + stars = {}
  119 + explosions = {}
  120 + backgroundstripes = 10
  121 + sunrot = 0
  122 +
  123 + lasers = {}
  124 +
  125 + realasteroiddelay = 1
  126 + movement1speed = 100
  127 + laserdelay = 0
  128 + reallaserdelay = 0.4
  129 + starttimer = 0
  130 + changegamestate("menu")
  131 +end
  132 +
  133 +function love.update(dt)
  134 + if skipupdate then
  135 + skipupdate = false
  136 + return
  137 + end
  138 +
  139 + sunrot = sunrot + dt*50
  140 +
  141 + starttimer = starttimer + dt
  142 +
  143 + if scoreanim < 1 then
  144 + scoreanim = scoreanim + (1-scoreanim)*8*dt
  145 + end
  146 +
  147 + if laserdelay > 0 then
  148 + laserdelay = math.max(0, laserdelay-dt)
  149 + end
  150 +
  151 + shake = math.random()*shakeamount*2-shakeamount
  152 +
  153 + if _G[gamestate .. "_update"] then
  154 + _G[gamestate .. "_update"](dt)
  155 + end
  156 +
  157 + --LASERS
  158 + local delete = {}
  159 +
  160 + for i, v in pairs(lasers) do
  161 + if v:update(dt) == true then
  162 + table.insert(delete, i)
  163 + end
  164 + end
  165 +
  166 + table.sort(delete, function(a,b) return a>b end)
  167 +
  168 + for i, v in pairs(delete) do
  169 + table.remove(lasers, v) --remove
  170 + end
  171 +end
  172 +
  173 +function pointsget(i)
  174 + points = points + i
  175 + scoreanim = 0
  176 + rainbowi = math.random()
  177 + shakeamount = 10
  178 +end
  179 +
  180 +function love.draw()
  181 + love.graphics.translate(50*scale, 40*scale)
  182 + love.graphics.rotate(shake/300)
  183 + love.graphics.translate(-50*scale, -40*scale)
  184 +
  185 + love.graphics.translate(shake*scale/4, shake*scale/4)
  186 +
  187 + if _G[gamestate .. "_draw"] then
  188 + _G[gamestate .. "_draw"]()
  189 + end
  190 +
  191 +
  192 + if gamestate ~= "menu" and gamestate ~= "scene6" and not landing then
  193 + local r, g, b = unpack(getrainbowcolor(rainbowi))
  194 +
  195 + local ar = r + (255-r)*scoreanim
  196 + local ag = g + (255-g)*scoreanim
  197 + local ab = b + (255-b)*scoreanim
  198 +
  199 + love.graphics.setColor(ar, ag, ab)
  200 +
  201 + local s = scale*0.5+(1-scoreanim)*10
  202 + love.graphics.rotate((1-scoreanim)*0.4)
  203 + properprint("score: " .. points, 2, 2, s)
  204 + love.graphics.rotate(-(1-scoreanim)*0.4)
  205 + end
  206 +
  207 + love.graphics.translate(-shake*scale/4, -shake*scale/4)
  208 +
  209 +
  210 + love.graphics.translate(50*scale, 40*scale)
  211 + love.graphics.rotate(-shake/300)
  212 + love.graphics.translate(-50*scale, -40*scale)
  213 + if fade > 0 then
  214 + love.graphics.setColor(255, 255, 255, 255*fade)
  215 + love.graphics.rectangle("fill", 0, 0, 100*scale, 80*scale)
  216 + love.graphics.setColor(255, 255, 255, 255)
  217 + end
  218 +end
  219 +
  220 +function love.keypressed(key, unicode)
  221 + if _G[gamestate .. "_keypressed"] then
  222 + _G[gamestate .. "_keypressed"](key, unicode)
  223 + end
  224 +
  225 + if key ~= "left" and key ~= "up" and key ~= "right" and key ~= "down" then
  226 + if _G[gamestate .. "_action"] then
  227 + _G[gamestate .. "_action"](key)
  228 + end
  229 + end
  230 +end
  231 +
  232 +function love.keyreleased(key, unicode)
  233 + if _G[gamestate .. "_keyreleased"] then
  234 + _G[gamestate .. "_keyreleased"](key, unicode)
  235 + end
  236 +end
  237 +
  238 +function changegamestate(i)
  239 + gamestate = i
  240 + if _G[gamestate .. "_load"] then
  241 + _G[gamestate .. "_load"]()
  242 + end
  243 +end
  244 +
  245 +function draw(drawable, x, y, r, sx, sy, ox, oy, kx, ky)
  246 + if not sx then
  247 + sx = 1
  248 + end
  249 + if not sy then
  250 + sy = 1
  251 + end
  252 + love.graphics.draw(drawable, x*scale, y*scale, r, sx*scale, sy*scale, ox, oy, kx, ky )
  253 +end
  254 +
  255 +function round(num, idp) --Not by me
  256 + local mult = 10^(idp or 0)
  257 + return math.floor(num * mult + 0.5) / mult
  258 +end
  259 +
  260 +function properprint(s, x, y, sc)
  261 + local sc = sc or scale
  262 + local startx = x
  263 + local skip = 0
  264 + for i = 1, string.len(tostring(s)) do
  265 + if skip > 0 then
  266 + skip = skip - 1
  267 + else
  268 + local char = string.sub(s, i, i)
  269 + if fontquads[char] then
  270 + love.graphics.drawq(fontimage, fontquads[char], x*scale+((i-1)*8+1)*sc, y*scale, 0, sc, sc)
  271 + end
  272 + end
  273 + end
  274 +end
  275 +
  276 +function round(num, idp) --Not by me
  277 + local mult = 10^(idp or 0)
  278 + return math.floor(num * mult + 0.5) / mult
  279 +end
  280 +
  281 +function getrainbowcolor(i, whiteness)
  282 + local whiteness = whiteness or 255
  283 + local r, g, b
  284 + if i < 1/6 then
  285 + r = 1
  286 + g = i*6
  287 + b = 0
  288 + elseif i >= 1/6 and i < 2/6 then
  289 + r = (1/6-(i-1/6))*6
  290 + g = 1
  291 + b = 0
  292 + elseif i >= 2/6 and i < 3/6 then
  293 + r = 0
  294 + g = 1
  295 + b = (i-2/6)*6
  296 + elseif i >= 3/6 and i < 4/6 then
  297 + r = 0
  298 + g = (1/6-(i-3/6))*6
  299 + b = 1
  300 + elseif i >= 4/6 and i < 5/6 then
  301 + r = (i-4/6)*6
  302 + g = 0
  303 + b = 1
  304 + else
  305 + r = 1
  306 + g = 0
  307 + b = (1/6-(i-5/6))*6
  308 + end
  309 +
  310 + local add = 0
  311 + if whiteness > 255 then
  312 + add = whiteness-255
  313 + end
  314 +
  315 + return {math.min(255, round(r*whiteness)+add), math.min(255, round(g*whiteness)+add), math.min(255, round(b*whiteness)+add), 255}
  316 +end
0 317 \ No newline at end of file
... ...
menu.lua 0 → 100644
  1 +++ a/menu.lua
... ... @@ -0,0 +1,125 @@
  1 +function menu_load()
  2 + love.graphics.setBackgroundColor(153, 217, 234)
  3 + clouds = {}
  4 + bushes = {}
  5 + love.audio.play(bgmusic)
  6 + for i = 1, 5 do
  7 + table.insert(clouds, cloud:new(true))
  8 + end
  9 + for i = 1, 30 do
  10 + table.insert(bushes, bush:new(true))
  11 + end
  12 +
  13 + textpos = {}
  14 + for i = 0, 7 do
  15 + textpos[i] = 10
  16 + end
  17 + playerframetimer = 0
  18 + playery = 50
  19 + playerx = 10
  20 + -- 1 2 3 4 5 6 7
  21 + startactions = {2.3, 4.6, 7, 8.20, 9.20, 10.20, 11.20}
  22 + starti = 0
  23 +
  24 +end
  25 +
  26 +function menu_update(dt)
  27 + for i, v in pairs(clouds) do
  28 + v:update(dt)
  29 + end
  30 + for i, v in pairs(bushes) do
  31 + v:update(dt)
  32 + end
  33 +
  34 + scrollx = scrollx + dt*50
  35 +
  36 + rainbowi = math.mod(rainbowi + dt/2, 1)
  37 + sini = math.mod(sini + dt*10, math.pi*2)
  38 + sini2 = math.mod(sini2 + dt*5, math.pi*2)
  39 +
  40 + if starttimer > startactions[starti+1] then
  41 + starti = starti+1
  42 + if starti == 7 then
  43 + changegamestate("scene1")
  44 + return
  45 + end
  46 + end
  47 +
  48 + if starti >= 4 then
  49 + shakeamount = shakeamount + dt*4
  50 + end
  51 + if starti >= 5 then
  52 + shakeamount = shakeamount + dt*10
  53 + end
  54 + if starti >= 6 then
  55 + shakeamount = shakeamount + dt*50
  56 + end
  57 +
  58 + for i = -1, starti-1 do
  59 + if i >= 0 then
  60 + textpos[i] = textpos[i]+(textpos[i]^2*dt)
  61 + end
  62 + end
  63 +
  64 + playerframetimer = playerframetimer + dt*10
  65 + while playerframetimer >= 2 do
  66 + playerframetimer = playerframetimer - 2
  67 + end
  68 + playerframe = math.floor(playerframetimer)+1
  69 +
  70 + playermovement1(dt)
  71 +end
  72 +
  73 +function menu_action()
  74 + shootlaser()
  75 +end
  76 +
  77 +function menu_draw()
  78 + love.graphics.setColor(255, 255, 255)
  79 + for i, v in pairs(clouds) do
  80 + v:draw()
  81 + end
  82 +
  83 + for i = 1, 2 do
  84 + draw(groundimg, -math.mod(scrollx, 120) + (i-1)*120, 59)
  85 + end
  86 + for i, v in pairs(bushes) do
  87 + v:draw()
  88 + end
  89 +
  90 + love.graphics.drawq(playerimg, playerquad[playerframe], playerx*scale, playery*scale, 0, scale, scale, 7, 12)
  91 + for i, v in pairs(lasers) do
  92 + v:draw()
  93 + end
  94 +
  95 + love.graphics.setColor(getrainbowcolor(rainbowi, 420))
  96 + draw(titleimg, 50, 23, math.sin(sini)/10, (math.sin(sini2)+1)/5+0.7, (math.sin(sini2)+1)/5+0.7, 50, 13)
  97 +
  98 + love.graphics.setColor(255, 0, 0)
  99 + if starti >= 0 then
  100 + properprint("directed by maurice", 13, 40+textpos[0], scale/2)
  101 + end
  102 + if starti >= 1 then
  103 + properprint("use arrow keys", 25, 40+textpos[1], scale/2)
  104 + end
  105 + if starti >= 2 then
  106 + properprint("and any other button", 9, 40+textpos[2], scale/2)
  107 + end
  108 + if starti >= 3 then
  109 + properprint("get ready...", 20, 40+textpos[3], scale/2)
  110 + end
  111 + if starti >= 4 then
  112 + properprint("3", 40, 40+textpos[4], scale*2)
  113 + end
  114 + if starti >= 5 then
  115 + properprint("2", 36, 40+textpos[5], scale*3)
  116 + end
  117 + if starti >= 6 then
  118 + properprint("1", 32, 40+textpos[6], scale*4)
  119 + end
  120 + if starti >= 7 then
  121 + properprint("go!", 10, 40+textpos[7], scale*6)
  122 + end
  123 +
  124 + love.graphics.setColor(255, 255, 255)
  125 +end
... ...
powerup.lua 0 → 100644
  1 +++ a/powerup.lua
... ... @@ -0,0 +1,47 @@
  1 +powerup = class:new()
  2 +
  3 +function powerup:init()
  4 + self.x = 108
  5 + self.y = math.random()*20+40
  6 + self.speed = 30
  7 + self.movement = 1
  8 + self.blinktimer = 0
  9 + self.blink = true
  10 +end
  11 +
  12 +function powerup:update(dt)
  13 + if self.movement == 1 then
  14 + self.y = self.y - dt*30
  15 + if self.y < 40 then
  16 + self.movement = -1
  17 + end
  18 + elseif self.movement == -1 then
  19 + self.y = self.y + dt*30
  20 + if self.y > 70 then
  21 + self.movement = 1
  22 + end
  23 + end
  24 +
  25 + self.blinktimer = self.blinktimer + dt
  26 + if self.blinktimer > 0.2 then
  27 + self.blinktimer = self.blinktimer - 0.5
  28 + self.blink = not self.blink
  29 + end
  30 +
  31 + self.x = self.x - self.speed*dt
  32 +end
  33 +
  34 +function powerup:checkcol(x, y)
  35 + if math.abs(self.x+8-x) < 10 and math.abs(self.y+4-y) < 10 then
  36 + return true
  37 + end
  38 + return false
  39 +end
  40 +
  41 +function powerup:draw()
  42 + draw(powerupimg, self.x, self.y, 0, 1, 1, 8, 4)
  43 + love.graphics.setColor(255, 0, 0)
  44 + if self.x > 0 and self.blink then
  45 + properprint("collect the powerup!!!", 10, 45, scale*0.5)
  46 + end
  47 +end
0 48 \ No newline at end of file
... ...
rocket.lua 0 → 100644
  1 +++ a/rocket.lua
... ... @@ -0,0 +1,227 @@
  1 +rocket = class:new()
  2 +
  3 +rocketspeed = 300
  4 +maxrocketspeed = 100
  5 +
  6 +function rocket:init()
  7 + self.x = 115
  8 + self.y = 60
  9 + self.r = 0
  10 + self.speedx = 0
  11 + self.ground = true
  12 + self.startingoffset = 0
  13 + self.thrusttimer = 0
  14 + thrusts = {}
  15 + machinegundelay = 0
  16 + self.explosiondelay = 0
  17 + self.explosiontimer = 0
  18 +end
  19 +
  20 +function rocket:update(dt)
  21 + if self.ground then
  22 + if self.x > 50 then
  23 + self.x = self.x - dt*50
  24 + if self.x < 50 then
  25 + self.x = 50
  26 + end
  27 + end
  28 + else
  29 + self.startingoffset = (math.random()*2-1)*0.5
  30 + end
  31 +
  32 + if self.starting then
  33 + self.startingtimer = self.startingtimer + dt
  34 + self.startingoffset = (math.random()*2-1)*2
  35 +
  36 + if self.startingtimer > 2 then
  37 + self.y = self.y - dt*5
  38 + self:thrusts(dt)
  39 + end
  40 +
  41 + if self.startingtimer > 7 then
  42 + self.y = self.y + dt*50
  43 +
  44 + if self.y > 70 then
  45 + self.starting = false
  46 + self.y = 70
  47 + changegamestate("scene3")
  48 + self.inflight = true
  49 + end
  50 + end
  51 + end
  52 +
  53 + if self.inflight then
  54 + if love.keyboard.isDown("right") and self.x < 100 then
  55 + self.speedx = self.speedx + dt*rocketspeed
  56 + elseif self.speedx > 0 then
  57 + self.speedx = math.max(0, self.speedx - dt*rocketspeed)
  58 + end
  59 +
  60 + if love.keyboard.isDown("left") and self.x > 0 then
  61 + self.speedx = self.speedx - dt*rocketspeed
  62 + elseif self.speedx < 0 then
  63 + self.speedx = math.min(0, self.speedx + dt*rocketspeed)
  64 + end
  65 +
  66 + self.speedx = math.min(maxrocketspeed, math.max(-maxrocketspeed, self.speedx))
  67 +
  68 + self.x = self.x + self.speedx*dt
  69 + if self.x > 100 then
  70 + self.x = 100
  71 + elseif self.x < 0 then
  72 + self.x = 0
  73 + end
  74 +
  75 + self.r = self.speedx/200
  76 +
  77 + if #pressedkeys > 0 then
  78 + machinegundelay = machinegundelay + dt
  79 + while machinegundelay > machinedelay do
  80 + self:fire()
  81 + machinegundelay = machinegundelay - machinedelay
  82 + end
  83 + end
  84 +
  85 + if wheatleytimer then
  86 + wheatleytimer = wheatleytimer + dt*2
  87 + wheatleyr = wheatleyr + dt*10
  88 +
  89 + if wheatleytimer >= 0.95 and wheatleytimer - dt*2 < 0.95 then
  90 + table.insert(explosions, explosion:new(self.x-20, self.y-20))
  91 + rocketimg = love.graphics.newImage("graphics/rocketkaputt.png")
  92 + changegamestate("scene4")
  93 + self.hit = true
  94 + self.inflight = false
  95 + end
  96 + end
  97 + end
  98 + shakeamount = self.startingoffset*3
  99 +
  100 + if self.hit then
  101 + wheatleytimer = wheatleytimer + dt*2
  102 + wheatleyr = wheatleyr + dt*10
  103 + if wheatleytimer < 4 then
  104 + if self.r > 0 then
  105 + self.r = self.r - dt
  106 + else
  107 + self.r = self.r + dt
  108 + end
  109 + else
  110 + if self.r < math.pi*0.9 then
  111 + self.r = self.r + dt
  112 + starmover = -self.r
  113 + self.y = self.y - dt*20
  114 + if self.x > 10 then
  115 + self.x = self.x - dt*10
  116 + elseif self.x < 10 then
  117 + self.x = self.x + dt*10
  118 + end
  119 + end
  120 + end
  121 +
  122 + self.explosiontimer = self.explosiontimer + dt
  123 + while self.explosiontimer > self.explosiondelay do
  124 + self.explosiontimer = self.explosiontimer - self.explosiondelay
  125 + self.explosiondelay = math.random(100)/300+0.1
  126 + table.insert(explosions, explosion:new(self.x-16+math.random(16)-8, self.y-20+math.random(16)-8))
  127 + end
  128 + self.startingoffset = self.startingoffset*10
  129 + end
  130 +
  131 + --THRUSTS
  132 + local delete = {}
  133 +
  134 + for i, v in pairs(thrusts) do
  135 + if v:update(dt) == true then
  136 + table.insert(delete, i)
  137 + end
  138 + end
  139 +
  140 + table.sort(delete, function(a,b) return a>b end)
  141 +
  142 + for i, v in pairs(delete) do
  143 + table.remove(thrusts, v) --remove
  144 + end
  145 +end
  146 +
  147 +function rocket:fire()
  148 + local outx = -math.sin(self.r) * -14 + self.x
  149 + local outy = math.cos(self.r) * -14 + self.y
  150 +
  151 + table.insert(bullets, bullet:new(outx, outy, self.r))
  152 +end
  153 +
  154 +function rocket:thrusts(dt) --if you know what I mean
  155 + self.thrusttimer = self.thrusttimer + dt
  156 + local delay = 0.01
  157 + while self.thrusttimer > delay do
  158 + self.thrusttimer = self.thrusttimer - delay
  159 + table.insert(thrusts, thrust:new(self.x-6, self.y+10))
  160 + table.insert(thrusts, thrust:new(self.x, self.y+10))
  161 + table.insert(thrusts, thrust:new(self.x+6, self.y+10))
  162 + end
  163 +end
  164 +
  165 +function rocket:start()
  166 + self.starting = true
  167 + self.ground = false
  168 + self.startingtimer = 0
  169 +end
  170 +
  171 +function rocket:checkcol(x, y)
  172 + if math.abs(self.x-x) < 16 and math.abs(self.y-y) < 16 then
  173 + return true
  174 + end
  175 + return false
  176 +end
  177 +
  178 +function rocket:draw()
  179 + local r, g, b = love.graphics.getColor()
  180 + for i, v in pairs(thrusts) do
  181 + v:draw()
  182 + end
  183 + love.graphics.setColor(r, g, b)
  184 + draw(rocketimg, self.x+self.startingoffset, self.y, self.r, 1, 1, 15, 16)
  185 +
  186 + if wheatleytimer then
  187 + if wheatleytimer <= 0.95 then
  188 + draw(wheatleyimg, self.x-20*(1-wheatleytimer/1), self.y-120*(1-wheatleytimer/1), wheatleyr, 1, 1, 8, 9)
  189 + else
  190 + draw(wheatleyimg, self.x-20*(1-0.95/1)-(wheatleytimer-0.95)*200, self.y-120*(1-wheatleytimer/1)+(wheatleytimer-0.95)*20, wheatleyr, 1, 1, 8, 9)
  191 + end
  192 + end
  193 +end
  194 +
  195 +function rocket:wheatleyattack()
  196 + wheatleytimer = 0
  197 + wheatleyr = 0
  198 + space:play()
  199 +end
  200 +
  201 +--THRUST
  202 +
  203 +thrust = class:new()
  204 +
  205 +function thrust:init(x, y)
  206 + self.x = x
  207 + self.y = y
  208 + self.starty = rockets[1].y
  209 + self.dir = (math.random()*2-1)*0.4+math.pi/2 + rockets[1].r
  210 + self.speed = 40
  211 + self.life = 1
  212 +end
  213 +
  214 +function thrust:update(dt)
  215 + self.x = self.x + math.cos(self.dir)*self.speed*dt
  216 + self.y = self.y + math.sin(self.dir)*self.speed*dt
  217 +
  218 + self.life = self.life - dt
  219 + if self.life <= 0 then
  220 + return true
  221 + end
  222 +end
  223 +
  224 +function thrust:draw()
  225 + love.graphics.setColor(255, 255, 255, 255*self.life)
  226 + love.graphics.rectangle("fill", self.x*scale, self.y*scale+(rockets[1].y-self.starty)*scale, scale, scale)
  227 +end
0 228 \ No newline at end of file
... ...
scene1.lua 0 → 100644
  1 +++ a/scene1.lua
... ... @@ -0,0 +1,189 @@
  1 +function scene1_load()
  2 + shakeamount = 0
  3 + shake = 0
  4 + fade = 1
  5 + enemies = {}
  6 + powerups = {}
  7 + enemytimer = 0
  8 + nextenemy = 0
  9 + nextstage = false
  10 +end
  11 +
  12 +function scene1_update(dt)
  13 + if shakeamount > 0 then
  14 + shakeamount = math.max(0, shakeamount-dt*10)
  15 + end
  16 +
  17 + enemytimer = enemytimer + dt
  18 + while enemytimer > nextenemy and not nextstage do
  19 + enemytimer = enemytimer - nextenemy
  20 + if massenemies then
  21 + nextenemy = math.random(10)/1000+.002
  22 + else
  23 + nextenemy = math.random(10)/10+.1
  24 + end
  25 + table.insert(enemies, enemy:new())
  26 + end
  27 + rainbowi = math.mod(rainbowi + dt/2, 1)
  28 +
  29 +
  30 + for i, v in pairs(clouds) do
  31 + v:update(dt)
  32 + end
  33 + for i, v in pairs(bushes) do
  34 + v:update(dt)
  35 + end
  36 + for i, v in pairs(powerups) do
  37 + v:update(dt)
  38 + end
  39 +
  40 + if starttimer > 32 and starttimer - dt < 32 then
  41 + table.insert(powerups, powerup:new())
  42 + end
  43 +
  44 + if starttimer > 45 and starttimer - dt < 45 then
  45 + nextstage = true
  46 + end
  47 +
  48 + if starttimer > 47 and starttimer - dt < 47 then
  49 + rockets = {rocket:new()}
  50 + end
  51 +
  52 + if powerups[1] and powerups[1]:checkcol(playerx, playery) then
  53 + reallaserdelay = 0.05
  54 + massenemies = true
  55 + powerups[1] = nil
  56 + end
  57 +
  58 + --ENEMIES
  59 + local delete = {}
  60 +
  61 + for i, v in pairs(enemies) do
  62 + if v:update(dt) == true then
  63 + table.insert(delete, i)
  64 + end
  65 + end
  66 +
  67 + table.sort(delete, function(a,b) return a>b end)
  68 +
  69 + for i, v in pairs(delete) do
  70 + table.remove(enemies, v) --remove
  71 + end
  72 +
  73 + --EXPLOSION
  74 + local delete = {}
  75 +
  76 + for i, v in pairs(explosions) do
  77 + if v:update(dt) == true then
  78 + table.insert(delete, i)
  79 + end
  80 + end
  81 +
  82 + table.sort(delete, function(a,b) return a>b end)
  83 +
  84 + for i, v in pairs(delete) do
  85 + table.remove(explosions, v) --remove
  86 + end
  87 +
  88 + if fade > 0 then
  89 + fade = math.max(0, fade-dt)
  90 + end
  91 +
  92 + playerframetimer = playerframetimer + dt*10
  93 + while playerframetimer >= 2 do
  94 + playerframetimer = playerframetimer - 2
  95 + end
  96 + playerframe = math.floor(playerframetimer)+1
  97 +
  98 + if not rockets or rockets[1].x > 50 then
  99 + scrollx = scrollx + dt*50
  100 + end
  101 +
  102 + if rockets and rockets[1]:checkcol(playerx, playery) and rockets[1].x <= 50 then
  103 + changegamestate("scene2")
  104 + end
  105 +
  106 + playermovement1(dt)
  107 +
  108 + if rockets then
  109 + rockets[1]:update(dt)
  110 + end
  111 +end
  112 +
  113 +function playermovement1(dt)
  114 + if love.keyboard.isDown("left") then
  115 + playerx = math.max(0, playerx-dt*movement1speed)
  116 + elseif love.keyboard.isDown("right") then
  117 + playerx = math.min(100, playerx+dt*movement1speed)
  118 + end
  119 +
  120 + if love.keyboard.isDown("up") then
  121 + playery = math.max(50, playery-dt*movement1speed)
  122 + elseif love.keyboard.isDown("down") then
  123 + playery = math.min(80, playery+dt*movement1speed)
  124 + end
  125 +end
  126 +
  127 +function scene1_action()
  128 + shootlaser()
  129 +end
  130 +
  131 +function shootlaser()
  132 + if laserdelay == 0 then
  133 + table.insert(lasers, laser:new(playerx, playery-8))
  134 + lasersound:stop()
  135 + lasersound:play()
  136 + laserdelay = reallaserdelay
  137 + end
  138 +end
  139 +
  140 +function scene1_draw()
  141 + local r, g, b = love.graphics.getColor()
  142 + love.graphics.setColor(math.random(255), math.random(255), math.random(255), 255*(1-scoreanim))
  143 + for i = 1, backgroundstripes, 2 do
  144 + local alpha = math.rad((i/backgroundstripes + math.mod(sunrot/100, 1)) * 360)
  145 + local point1 = {50*scale+100*scale*math.cos(alpha), 64*scale+100*scale*math.sin(alpha)}
  146 +
  147 + local alpha = math.rad(((i+1)/backgroundstripes + math.mod(sunrot/100, 1)) * 360)
  148 + local point2 = {50*scale+100*scale*math.cos(alpha), 64*scale+100*scale*math.sin(alpha)}
  149 +
  150 + love.graphics.polygon("fill", 50*scale, 64*scale, point1[1], point1[2], point2[1], point2[2])
  151 + end
  152 + love.graphics.setColor(r, g, b, 255)
  153 +
  154 + for i, v in pairs(clouds) do
  155 + v:draw()
  156 + end
  157 +
  158 + for i = 1, 2 do
  159 + draw(groundimg, -math.mod(scrollx, 100) + (i-1)*100, 59)
  160 + end
  161 + for i, v in pairs(bushes) do
  162 + v:draw()
  163 + end
  164 + for i, v in pairs(enemies) do
  165 + v:draw()
  166 + end
  167 + for i, v in pairs(explosions) do
  168 + v:draw()
  169 + end
  170 +
  171 + if rockets then
  172 + rockets[1]:draw()
  173 + end
  174 +
  175 + love.graphics.drawq(playerimg, playerquad[playerframe], playerx*scale, playery*scale, 0, scale, scale, 7, 12)
  176 + for i, v in pairs(lasers) do
  177 + v:draw()
  178 + end
  179 + love.graphics.setColor(255, 255, 255)
  180 + for i, v in pairs(powerups) do
  181 + v:draw()
  182 + end
  183 +
  184 + if starttimer > 46 then
  185 + love.graphics.setColor(255, 0, 0)
  186 + properprint("get in the rocket!!!", 10, 45, scale*0.5)
  187 + end
  188 + love.graphics.setColor(255, 255, 255)
  189 +end
0 190 \ No newline at end of file
... ...
scene2.lua 0 → 100644
  1 +++ a/scene2.lua
... ... @@ -0,0 +1,75 @@
  1 +function scene2_load()
  2 + starttimer = 0
  3 + shakeamount = 0
  4 + rockets[1].x = 50
  5 + rockets[1]:start()
  6 + launchsound:stop()
  7 + launchsound:play()
  8 +
  9 + for y = 1, 30 do
  10 + for i = 1, 5 do
  11 + table.insert(clouds, cloud:new(true, -y*30))
  12 + end
  13 + end
  14 +
  15 + backgroundcolor = {love.graphics.getBackgroundColor()}
  16 +end
  17 +
  18 +function scene2_update(dt)
  19 + for i, v in pairs(clouds) do
  20 + v:update(dt)
  21 + end
  22 + rockets[1]:update(dt)
  23 +
  24 + if starttimer > 7 then
  25 + love.graphics.setBackgroundColor(0, 0, 0)
  26 + elseif starttimer > 6 then
  27 + local r, g, b = unpack(backgroundcolor)
  28 + r = r*(1-(starttimer-6)/1)
  29 + g = g*(1-(starttimer-6)/1)
  30 + b = b*(1-(starttimer-6)/1)
  31 +
  32 + love.graphics.setBackgroundColor(r, g, b)
  33 + end
  34 +
  35 + if starttimer > 7 then
  36 + if starttimer - dt <= 7 then
  37 + for i = 1, 10 do
  38 + table.insert(stars, star:new())
  39 + end
  40 + end
  41 +
  42 + staralpha = math.min(1, (starttimer-7)/9)
  43 + end
  44 +end
  45 +
  46 +function scene2_draw()
  47 +
  48 + local launchoffset = 0
  49 + if starttimer > 3 then
  50 + launchoffset = 10^(starttimer-3)+(starttimer-3)*20
  51 + end
  52 +
  53 + love.graphics.translate(0, launchoffset)
  54 +
  55 + for i, v in pairs(clouds) do
  56 + v:draw()
  57 + end
  58 +
  59 + for i = 1, 2 do
  60 + draw(groundimg, -math.mod(scrollx, 100) + (i-1)*100, 59)
  61 + end
  62 + for i, v in pairs(bushes) do
  63 + v:draw()
  64 + end
  65 + love.graphics.translate(0, -launchoffset)
  66 +
  67 +
  68 + for i,v in pairs(stars) do
  69 + v:draw()
  70 + end
  71 +
  72 + love.graphics.setColor(255, 255, 255, 255)
  73 +
  74 + rockets[1]:draw()
  75 +end
0 76 \ No newline at end of file
... ...
scene3.lua 0 → 100644
  1 +++ a/scene3.lua
... ... @@ -0,0 +1,153 @@
  1 +function scene3_load()
  2 + backgroundwhite = 0
  3 + staralpha = 1
  4 + asteroids = {}
  5 + bullets = {}
  6 + asteroidtimer = 0
  7 + rockets = {rocket:new()}
  8 + love.audio.play(bgmusic)
  9 + rockets[1].x = 50
  10 + rockets[1].y = 70
  11 + rockets[1].ground = false
  12 + rockets[1].inflight = true
  13 +
  14 + table.insert(asteroids, asteroid:new())
  15 +
  16 + if #stars == 0 then
  17 + for i = 1, 10 do
  18 + table.insert(stars, star:new())
  19 + end
  20 + end
  21 +
  22 + lastexplosion = {50, 40}
  23 +
  24 + pressedkeys = {}
  25 + starttimer = 0
  26 + warningtimer = 0
  27 +end
  28 +
  29 +function scene3_update(dt)
  30 + realasteroiddelay = math.max(0.05, 8/starttimer)
  31 + backgroundwhite = math.max(0, backgroundwhite - dt)
  32 + love.graphics.setBackgroundColor(math.random(127)*backgroundwhite, math.random(127)*backgroundwhite, math.random(127)*backgroundwhite)
  33 +
  34 + if starttimer < 35 then
  35 + asteroidtimer = asteroidtimer + dt
  36 +
  37 + while asteroidtimer > realasteroiddelay do
  38 + asteroidtimer = asteroidtimer - realasteroiddelay
  39 + table.insert(asteroids, asteroid:new())
  40 + end
  41 + end
  42 +
  43 + for i, v in pairs(stars) do
  44 + v:update(dt)
  45 + end
  46 +
  47 + --ASTEROIDS
  48 + local delete = {}
  49 +
  50 + for i, v in pairs(asteroids) do
  51 + if v:update(dt) == true then
  52 + table.insert(delete, i)
  53 + end
  54 + end
  55 +
  56 + table.sort(delete, function(a,b) return a>b end)
  57 +
  58 + for i, v in pairs(delete) do
  59 + table.remove(asteroids, v) --remove
  60 + end
  61 +
  62 + --BULLETS
  63 + local delete = {}
  64 +
  65 + for i, v in pairs(bullets) do
  66 + if v:update(dt) == true then
  67 + table.insert(delete, i)
  68 + end
  69 + end
  70 +
  71 + table.sort(delete, function(a,b) return a>b end)
  72 +
  73 + for i, v in pairs(delete) do
  74 + table.remove(bullets, v) --remove
  75 + end
  76 +
  77 +
  78 +
  79 + --EXPLOSION
  80 + local delete = {}
  81 +
  82 + for i, v in pairs(explosions) do
  83 + if v:update(dt) == true then
  84 + table.insert(delete, i)
  85 + end
  86 + end
  87 +
  88 + table.sort(delete, function(a,b) return a>b end)
  89 +
  90 + for i, v in pairs(delete) do
  91 + table.remove(explosions, v) --remove
  92 + end
  93 +
  94 + rockets[1]:update(dt)
  95 +
  96 + if (starttimer > 38 and starttimer < 40) or warningtimer > 0.1 then
  97 + warningtimer = math.mod(warningtimer + dt*7, math.pi*2)
  98 + end
  99 +
  100 + if starttimer >= 40 and starttimer - dt < 40 then
  101 + rockets[1]:wheatleyattack()
  102 + end
  103 +end
  104 +
  105 +function scene3_draw()
  106 + local r, g, b = love.graphics.getColor()
  107 + love.graphics.setColor(math.random(255), math.random(255), math.random(255), 255*(1-scoreanim))
  108 + for i = 1, backgroundstripes, 2 do
  109 + local alpha = math.rad((i/backgroundstripes + math.mod(sunrot/100, 1)) * 360)
  110 + local point1 = {lastexplosion[1]*scale+200*scale*math.cos(alpha), lastexplosion[2]*scale+200*scale*math.sin(alpha)}
  111 +
  112 + local alpha = math.rad(((i+1)/backgroundstripes + math.mod(sunrot/100, 1)) * 360)
  113 + local point2 = {lastexplosion[1]*scale+200*scale*math.cos(alpha), lastexplosion[2]*scale+200*scale*math.sin(alpha)}
  114 +
  115 + love.graphics.polygon("fill", lastexplosion[1]*scale, lastexplosion[2]*scale, point1[1], point1[2], point2[1], point2[2])
  116 + end
  117 + love.graphics.setColor(r, g, b, 255)
  118 +
  119 + for i,v in pairs(stars) do
  120 + v:draw()
  121 + end
  122 + for i,v in pairs(asteroids) do
  123 + v:draw()
  124 + end
  125 +
  126 + rockets[1]:draw()
  127 + for i,v in pairs(bullets) do
  128 + v:draw()
  129 + end
  130 + for i, v in pairs(explosions) do
  131 + v:draw()
  132 + end
  133 +
  134 + if (starttimer > 38 and starttimer < 40) or warningtimer > 0.1 then
  135 + love.graphics.setColor(255, 0, 0, math.abs(math.sin(warningtimer))*255)
  136 + draw(warningimg, -3+math.random(5)-3, 20+math.random(5)-3)
  137 + end
  138 +end
  139 +
  140 +function scene3_keypressed(key)
  141 + if key ~= "left" and key ~= "up" and key ~= "right" and key ~= "down" then
  142 + table.insert(pressedkeys, key)
  143 + end
  144 +end
  145 +
  146 +function scene3_keyreleased(key)
  147 + for i = 1, #pressedkeys do
  148 + if pressedkeys[i] == key then
  149 + table.remove(pressedkeys, i)
  150 + break
  151 + end
  152 + end
  153 +end
0 154 \ No newline at end of file
... ...
scene4.lua 0 → 100644
  1 +++ a/scene4.lua
... ... @@ -0,0 +1,174 @@
  1 +function scene4_load()
  2 + backgroundwhite = 0
  3 + staralpha = 1
  4 + asteroids = {}
  5 + bullets = {}
  6 + love.audio.play(bgmusic)
  7 +
  8 + starttimer = 0
  9 + alerttimer = 0
  10 + flyingquad = 3
  11 +
  12 + pspeedx = 0
  13 + pspeedy = 0
  14 +
  15 + playerx = nil
  16 +
  17 + flyanimationtimer = 0
  18 +end
  19 +
  20 +function scene4_update(dt)
  21 + if secondtimer then
  22 + secondtimer = secondtimer + dt
  23 + end
  24 + for i, v in pairs(stars) do
  25 + v:update(dt)
  26 + end
  27 +
  28 + --EXPLOSION
  29 + local delete = {}
  30 +
  31 + for i, v in pairs(explosions) do
  32 + if v:update(dt) == true then
  33 + table.insert(delete, i)
  34 + end
  35 + end
  36 +
  37 + table.sort(delete, function(a,b) return a>b end)
  38 +
  39 + for i, v in pairs(delete) do
  40 + table.remove(explosions, v) --remove
  41 + end
  42 +
  43 + if rockets[1] then
  44 + rockets[1]:update(dt)
  45 + end
  46 +
  47 + if (starttimer > 0 and starttimer < 3) or alerttimer > 0.1 then
  48 + alerttimer = math.mod(alerttimer + dt*7, math.pi*2)
  49 + end
  50 +
  51 + if jumped then
  52 + if rockets[1] then
  53 + rockets[1].x = rockets[1].x - dt*3
  54 + end
  55 +
  56 + if rockets[1] and secondtimer > 2 and secondtimer - dt <= 2 then
  57 + for i = 1, 20 do
  58 + if explosions then
  59 + table.insert(explosions, explosion:new(rockets[1].x-16+math.random(16)-8, rockets[1].y-20+math.random(16)-8))
  60 + end
  61 + end
  62 + starmover = math.pi
  63 + rockets[1] = nil
  64 + end
  65 +
  66 + playerx = playerx + pspeedx*dt
  67 + playery = playery + pspeedy*dt
  68 +
  69 + if pspeedx > 0 then
  70 + pspeedx = pspeedx - dt*5
  71 + end
  72 +
  73 + if playery >= 20 then
  74 + playery = 20
  75 + pspeedy = 0
  76 + end
  77 +
  78 + if playerx >= 50 then
  79 + pspeedx = 0
  80 + playerx = 50
  81 + end
  82 +
  83 + if secondtimer > 2 then
  84 + local i = math.max(0, (1-(secondtimer-2)/2))
  85 + staralpha = math.max(0, (1-(secondtimer-2)/2))*i
  86 + love.graphics.setBackgroundColor(153*(1-i), 217*(1-i), 234*(1-i))
  87 +
  88 + if shakeamount < 5 then
  89 + shakeamount = math.min(5, shakeamount+dt*3)
  90 + elseif shakeamount > 5 then
  91 + shakeamount = math.max(5, shakeamount-dt*3)
  92 + end
  93 + end
  94 +
  95 + if secondtimer > 4 then
  96 + changegamestate("scene5")
  97 + end
  98 + end
  99 +
  100 + if starttimer >= 4.3 and starttimer - dt < 4.3 then
  101 + playerx = rockets[1].x+4
  102 + playery = rockets[1].y
  103 + end
  104 +
  105 + if jumped then
  106 + flyanimationtimer = flyanimationtimer + dt
  107 + while flyanimationtimer > 0.1 do
  108 + flyanimationtimer = flyanimationtimer - 0.1
  109 + if flyingquad == 3 then
  110 + flyingquad = 4
  111 + else
  112 + flyingquad = 3
  113 + end
  114 + end
  115 + end
  116 +end
  117 +
  118 +function scene4_draw()
  119 + local r, g, b = love.graphics.getColor()
  120 + love.graphics.setColor(math.random(255), math.random(255), math.random(255), 255*(1-scoreanim))
  121 + for i = 1, backgroundstripes, 2 do
  122 + local alpha = math.rad((i/backgroundstripes + math.mod(sunrot/100, 1)) * 360)
  123 + local point1 = {lastexplosion[1]*scale+200*scale*math.cos(alpha), lastexplosion[2]*scale+200*scale*math.sin(alpha)}
  124 +
  125 + local alpha = math.rad(((i+1)/backgroundstripes + math.mod(sunrot/100, 1)) * 360)
  126 + local point2 = {lastexplosion[1]*scale+200*scale*math.cos(alpha), lastexplosion[2]*scale+200*scale*math.sin(alpha)}
  127 +
  128 + love.graphics.polygon("fill", lastexplosion[1]*scale, lastexplosion[2]*scale, point1[1], point1[2], point2[1], point2[2])
  129 + end
  130 + love.graphics.setColor(r, g, b, 255)
  131 +
  132 + for i,v in pairs(stars) do
  133 + v:draw()
  134 + end
  135 +
  136 +
  137 + if playerx then
  138 + local off = 0
  139 + if rockets[1] then
  140 + off = rockets[1].startingoffset
  141 + end
  142 + love.graphics.drawq(playerimg, playerquad[flyingquad], (playerx+off)*scale, playery*scale, 0, scale, scale, 13, 6)
  143 + end
  144 +
  145 + if rockets[1] then
  146 + rockets[1]:draw()
  147 + end
  148 + for i, v in pairs(explosions) do
  149 + v:draw()
  150 + end
  151 +
  152 + if (starttimer > 0 and starttimer < 3) or alerttimer > 0.1 then
  153 + local i = math.abs(math.sin(alerttimer))
  154 + love.graphics.setColor(255, 0, 0, i*100)
  155 + love.graphics.rectangle("fill", 0, 0, 100*scale, 80*scale)
  156 + love.graphics.setColor(255, 0, 0, i*255)
  157 + draw(alertimg, 50+math.random(5)-3, 40+math.random(5)-3, (math.random()*2-1)*0.1, i*0.5+0.6, i*0.5+0.6, 54, 15)
  158 + draw(randomshitimg, 50+math.random(20)-10, 40+math.random(20)-10, 0, 1, 1, 50, 42)
  159 + end
  160 +
  161 + if starttimer > 4 and not jumped then
  162 + love.graphics.setColor(255, 0, 0, math.random(255))
  163 + properprint("jump!!", 0, 40, scale*3)
  164 + end
  165 +end
  166 +
  167 +function scene4_action()
  168 + if starttimer > 4.3 and not jumped then
  169 + jumped = true
  170 + secondtimer = 0
  171 + pspeedx = 20
  172 + pspeedy = 2
  173 + end
  174 +end
0 175 \ No newline at end of file
... ...
scene5.lua 0 → 100644
  1 +++ a/scene5.lua
... ... @@ -0,0 +1,229 @@
  1 +function scene5_load()
  2 + love.graphics.setBackgroundColor(153, 217, 234)
  3 + love.audio.play(bgmusic)
  4 +
  5 + clouds2 = {}
  6 + for i = 1, 3 do
  7 + for y = 1, 8 do
  8 + table.insert(clouds2, cloud2:new(math.random()*140))
  9 + end
  10 + end
  11 +
  12 + lastexplosion = {50, 40}
  13 +
  14 + starttimer = 0
  15 + flyingquad = 3
  16 +
  17 + playerx = 50
  18 + playery = 20
  19 + pspeedx = 0
  20 + pspeedy = 0
  21 +
  22 + birds = {}
  23 + splatters = {}
  24 + birdtimer = 0
  25 +
  26 + flyanimationtimer = 0
  27 +
  28 + shakeamount = 5
  29 + awesometimer = 0
  30 +
  31 + screenx = 0
  32 +
  33 + landingtime = 2
  34 + groundy = 90
  35 +
  36 + landing = false
  37 +end
  38 +
  39 +function scene5_update(dt)
  40 + if starttimer < 20 then
  41 + birdtimer = birdtimer + dt
  42 + local birddelay = 0.5
  43 + while birdtimer > birddelay do
  44 + birdtimer = birdtimer - birddelay
  45 + table.insert(birds, bird:new())
  46 + end
  47 + end
  48 +
  49 + if starttimer >= 25 and starttimer - dt < 25 then
  50 + landing = true
  51 + timeleft = landingtime
  52 + landingx = math.random(60)+20
  53 + end
  54 +
  55 + if starttimer >= 25.4 and starttimer - dt < 25.4 then
  56 + approach:play()
  57 + end
  58 +
  59 + if landing then
  60 + timeleft = timeleft - dt
  61 + if timeleft <= 0 then
  62 + timeleft = 0
  63 + groundy = groundy - 400*dt
  64 + if groundy <= playery-10 then
  65 + changegamestate("scene6")
  66 + end
  67 + end
  68 + end
  69 +
  70 + for i,v in pairs(clouds2) do
  71 + v:update(dt)
  72 + end
  73 +
  74 + flyanimationtimer = flyanimationtimer + dt
  75 + while flyanimationtimer > 0.1 do
  76 + flyanimationtimer = flyanimationtimer - 0.1
  77 + if flyingquad == 3 then
  78 + flyingquad = 4
  79 + else
  80 + flyingquad = 3
  81 + end
  82 + end
  83 +
  84 + if awesometimer > 0 then
  85 + awesometimer = awesometimer - dt
  86 + end
  87 +
  88 + if landing or starttimer < 24 then
  89 + playermovement2(dt)
  90 + else
  91 + if playerx > 50 then
  92 + playerx = playerx - 50*dt
  93 + elseif playerx < 50 then
  94 + playerx = playerx + 50*dt
  95 + end
  96 +
  97 + if playery > 40 then
  98 + playery = playery - 50*dt
  99 + elseif playery < 40 then
  100 + playery = playery + 50*dt
  101 + end
  102 + end
  103 +
  104 +
  105 + --BIRDS
  106 + local delete = {}
  107 +
  108 + for i, v in pairs(birds) do
  109 + if v:update(dt) == true then
  110 + table.insert(delete, i)
  111 + end
  112 + end
  113 +
  114 + table.sort(delete, function(a,b) return a>b end)
  115 +
  116 + for i, v in pairs(delete) do
  117 + table.remove(birds, v) --remove
  118 + end
  119 +
  120 +
  121 + --SPLATTERS
  122 + local delete = {}
  123 +
  124 + for i, v in pairs(splatters) do
  125 + if v:update(dt) == true then
  126 + table.insert(delete, i)
  127 + end
  128 + end
  129 +
  130 + table.sort(delete, function(a,b) return a>b end)
  131 +
  132 + for i, v in pairs(delete) do
  133 + table.remove(splatters, v) --remove
  134 + end
  135 +
  136 + for i, v in pairs(birds) do
  137 + if v:checkcol(playerx, playery) then
  138 + splat:stop()
  139 + splat:play()
  140 + pointsget(20)
  141 + table.insert(splatters, splatter:new(v.x, v.y))
  142 + skycolor = getrainbowcolor(math.random(), 400)
  143 + love.graphics.setBackgroundColor(skycolor)
  144 + lastexplosion = {v.x, v.y}
  145 + end
  146 + end
  147 +end
  148 +
  149 +function playermovement2(dt)
  150 + if love.keyboard.isDown("left") then
  151 + playerx = math.max(0, playerx-dt*movement1speed)
  152 + elseif love.keyboard.isDown("right") then
  153 + playerx = math.min(100, playerx+dt*movement1speed)
  154 + end
  155 +
  156 + if not landing then
  157 + if love.keyboard.isDown("up") then
  158 + playery = math.max(0, playery-dt*movement1speed)
  159 + elseif love.keyboard.isDown("down") then
  160 + playery = math.min(80, playery+dt*movement1speed)
  161 + end
  162 + end
  163 +end
  164 +
  165 +function scene5_draw()
  166 + local r, g, b = love.graphics.getColor()
  167 + love.graphics.setColor(math.random(255), math.random(255), math.random(255), 100*math.min(1, (starttimer/2)))
  168 + for i = 1, backgroundstripes, 2 do
  169 + local pos = {playerx, playery}
  170 + local alpha = math.rad((i/backgroundstripes + math.mod(sunrot/100, 1)) * 360)
  171 + local point1 = {pos[1]*scale+200*scale*math.cos(alpha), pos[2]*scale+200*scale*math.sin(alpha)}
  172 +
  173 + local alpha = math.rad(((i+1)/backgroundstripes + math.mod(sunrot/100, 1)) * 360)
  174 + local point2 = {pos[1]*scale+200*scale*math.cos(alpha), pos[2]*scale+200*scale*math.sin(alpha)}
  175 +
  176 + love.graphics.polygon("fill", pos[1]*scale, pos[2]*scale, point1[1], point1[2], point2[1], point2[2])
  177 + end
  178 + love.graphics.setColor(r, g, b, 255)
  179 +
  180 + for i,v in pairs(clouds2) do
  181 + v:draw()
  182 + end
  183 + for i,v in pairs(birds) do
  184 + v:draw()
  185 + end
  186 + for i,v in pairs(splatters) do
  187 + v:draw()
  188 + end
  189 +
  190 + if groundy < 90 then
  191 + draw(groundwinimg, -200+landingx+2, groundy)
  192 + end
  193 +
  194 + love.graphics.drawq(playerimg, playerquad[flyingquad], (playerx)*scale, playery*scale, 0, scale, scale, 13, 6)
  195 +
  196 +
  197 + if sunglasses then
  198 + draw(sunglassesimg, playerx+4, playery)
  199 + end
  200 +
  201 + if awesometimer > 0 then
  202 + draw(awesomeimg, (awesometimer*2-1)*100, 0)
  203 + love.graphics.setColor(0, 0, 0)
  204 + properprint("1000 points!", (awesometimer*2-1)*100+3, 73, scale)
  205 + love.graphics.setColor(255, 255, 255)
  206 + end
  207 +
  208 + if starttimer > 24 then
  209 + if math.mod(starttimer*5, 2) >= 1 then
  210 + love.graphics.setColor(255, 0, 0)
  211 + properprint("land in the target!", 0, 20, scale/1.5)
  212 + love.graphics.setColor(255, 255, 255)
  213 + end
  214 + end
  215 +
  216 + if landing then
  217 + draw(arrowimg, math.max(8, landingx-(timeleft/landingtime)*80), 67, 0, 1, 1, 8)
  218 + draw(arrowimg, math.min(91, landingx+(timeleft/landingtime)*80), 67, 0, -1, 1, 9)
  219 + end
  220 +end
  221 +
  222 +function scene5_action()
  223 + if not sunglasses then
  224 + sunglasses = true
  225 + awesometimer = 1
  226 + pointsget(1000)
  227 + sunglassessound:play()
  228 + end
  229 +end
0 230 \ No newline at end of file
... ...
scene6.lua 0 → 100644
  1 +++ a/scene6.lua
... ... @@ -0,0 +1,174 @@
  1 +function scene6_load()
  2 + love.graphics.setBackgroundColor(153, 217, 234)
  3 + love.audio.stop(bgmusic)
  4 +
  5 + clouds2 = {}
  6 + clouds = {}
  7 + bushes = {}
  8 + bigexplosions = {}
  9 +
  10 + playerquad = 1
  11 +
  12 + if sunglasses then
  13 + playerquad = 3
  14 + end
  15 +
  16 + playeranimationtimer = 0
  17 + starttimer = 0
  18 +
  19 + birds = {}
  20 + splatters = {}
  21 +
  22 + shakeamount = 10
  23 +
  24 + fade = 0
  25 +
  26 + playerx = playerx or 50
  27 + landingx = landingx or 50
  28 +
  29 + landdiff = playerx-landingx
  30 +
  31 + scoremul = round((1-math.abs(landdiff)/80)^8*4, 1) + 1
  32 +
  33 + stars = {}
  34 +
  35 + texts = {}
  36 + texts[1] = "your awesome score:"
  37 + texts[2] = points
  38 + texts[3] = ""
  39 + texts[4] = "radical landing mul:"
  40 + texts[5] = scoremul
  41 + texts[6] = ""
  42 + texts[7] = "cray total:"
  43 + texts[8] = math.ceil(points*scoremul)
  44 +
  45 + prevt = 0
  46 +
  47 + to = 0
  48 + totimes = {8.55, 8.8, 9.4, 9.5, 9.7, 11.0, 12.3, 12.9, 13.2}
  49 +end
  50 +
  51 +function scene6_update(dt)
  52 + playeranimationtimer = playeranimationtimer + dt
  53 + while playeranimationtimer > 0.1 do
  54 + playeranimationtimer = playeranimationtimer - 0.1
  55 + playerquad = playerquad + 1
  56 + if playerquad == 3 then
  57 + playerquad = 1
  58 + elseif playerquad == 5 then
  59 + playerquad = 3
  60 + end
  61 + end
  62 +
  63 + for i, v in pairs(bigexplosions) do
  64 + v:update(dt)
  65 + end
  66 +
  67 + if starttimer >= 0.7 and starttimer - dt < 0.7 then
  68 + bigexplosionsound:play()
  69 + end
  70 +
  71 + if starttimer < 0.2 then
  72 +
  73 + elseif starttimer < 0.5 then
  74 + fade = 1
  75 +
  76 + if #explosions == 0 then
  77 + table.insert(bigexplosions, bigexplosion:new(-4, -30))
  78 + table.insert(bigexplosions, bigexplosion:new(-40, -30))
  79 + table.insert(bigexplosions, bigexplosion:new(36, -30))
  80 + table.insert(bigexplosions, bigexplosion:new(-4, -50))
  81 + end
  82 + elseif starttimer < 4 then
  83 + if fade > 0.5 then
  84 + fade = fade - dt/2
  85 + end
  86 + else
  87 + if fade > 0 then
  88 + fade = fade - dt/2
  89 + end
  90 + end
  91 +
  92 +
  93 + if starttimer > 8.3 and starttimer - dt < 8.3 then
  94 + credits:play()
  95 + end
  96 +
  97 + if shakeamount > 0 then
  98 + shakeamount = shakeamount - dt*3
  99 + end
  100 +
  101 + for i = 1, 9 do
  102 + if starttimer > totimes[i] then
  103 + to = i
  104 + end
  105 + end
  106 +
  107 + if starttimer >= 15.7 and starttimer -dt < 15.7 then
  108 + staralpha = 1
  109 +
  110 + stars = {}
  111 + love.graphics.setBackgroundColor(0, 0, 0)
  112 + for i = 1, 10 do
  113 + table.insert(stars, star:new())
  114 + end
  115 + end
  116 + for i,v in pairs(stars) do
  117 + v:update(dt)
  118 + end
  119 +end
  120 +
  121 +function scene6_draw()
  122 + local r, g, b = love.graphics.getColor()
  123 + for i = 1, backgroundstripes, 1 do
  124 + if math.mod(i, 2) == 1 then
  125 + love.graphics.setColor(255, 255, 0, math.min(1, math.max(0, 1-(starttimer-7)/2))*255)
  126 + else
  127 + love.graphics.setColor(255, 0, 0, math.min(1, math.max(0, 1-(starttimer-7)/2))*255)
  128 + end
  129 + local pos = {31, 53}
  130 + local alpha = math.rad((i/backgroundstripes + math.mod(sunrot/100, 1)) * 360)
  131 + local point1 = {pos[1]*scale+200*scale*math.cos(alpha), pos[2]*scale+200*scale*math.sin(alpha)}
  132 +
  133 + local alpha = math.rad(((i+1)/backgroundstripes + math.mod(sunrot/100, 1)) * 360)
  134 + local point2 = {pos[1]*scale+200*scale*math.cos(alpha), pos[2]*scale+200*scale*math.sin(alpha)}
  135 +
  136 + love.graphics.polygon("fill", pos[1]*scale, pos[2]*scale, point1[1], point1[2], point2[1], point2[2])
  137 + end
  138 + love.graphics.setColor(r, g, b, 255)
  139 + for i,v in pairs(stars) do
  140 + v:draw()
  141 + v:draw()
  142 + v:draw()
  143 + v:draw()
  144 + end
  145 +
  146 + love.graphics.translate(20*scale, 50*scale)
  147 + love.graphics.rotate(math.pi/7)
  148 + love.graphics.translate(-20*scale, -50*scale)
  149 +
  150 + for i, v in pairs(bigexplosions) do
  151 + v:draw()
  152 + end
  153 +
  154 + draw(groundwinimg, -168-landdiff, 56)
  155 + love.graphics.drawq(winplayerimg, winplayerquad[playerquad], 30*scale, 55*scale, 0, scale, scale, 5, 13)
  156 +
  157 + love.graphics.translate(20*scale, 50*scale)
  158 + love.graphics.rotate(-math.pi/7)
  159 + love.graphics.translate(-20*scale, -50*scale)
  160 +
  161 + for i = 1, math.min(9, to) do
  162 + local s = scale/2
  163 + if i >= 8 then
  164 + s = s * 2
  165 + love.graphics.setColor(getrainbowcolor(math.random()))
  166 + end
  167 + if i == 9 then
  168 + draw(titleimg, 65, 65, 0, 0.7, 0.7, 50, 14)
  169 + else
  170 + properprint(texts[i], 50-tostring(texts[i]):len()*s/2, 5*i, s)
  171 + end
  172 + love.graphics.setColor(255, 255, 255)
  173 + end
  174 +end
0 175 \ No newline at end of file
... ...
splatter.lua 0 → 100644
  1 +++ a/splatter.lua
... ... @@ -0,0 +1,23 @@
  1 +splatter = class:new()
  2 +
  3 +function splatter:init(x, y)
  4 + self.x = x
  5 + self.y = y
  6 + self.quad = 1
  7 + self.quadtimer = 0
  8 +end
  9 +
  10 +function splatter:update(dt)
  11 + self.quadtimer = self.quadtimer + dt*30
  12 + if self.quadtimer > 1 then
  13 + self.quadtimer = self.quadtimer - 1
  14 + self.quad = self.quad + 1
  15 + if self.quad == 7 then
  16 + return true
  17 + end
  18 + end
  19 +end
  20 +
  21 +function splatter:draw()
  22 + love.graphics.drawq(splatterimg, splatterquad[self.quad], self.x*scale, self.y*scale, 0, scale/2, scale/2, 40, 40)
  23 +end
0 24 \ No newline at end of file
... ...
star.lua 0 → 100644
  1 +++ a/star.lua
... ... @@ -0,0 +1,37 @@
  1 +star = class:new()
  2 +
  3 +function star:init()
  4 + self.x = math.random(100)
  5 + self.y = math.random(80)-90
  6 + self.speed = math.random(10)+1000
  7 +end
  8 +
  9 +function star:update(dt)
  10 + if not starmover then
  11 + self.y = self.y + self.speed*dt
  12 + else
  13 + self.y = self.y + math.cos(starmover)*self.speed*dt
  14 + self.x = self.x + math.sin(starmover)*self.speed*dt
  15 + end
  16 +
  17 + if self.y > 110 or self.y < -10 or self.x > 110 or self.x < -10 then
  18 + self.speed = math.random(10)+1000
  19 + self.x = math.random(100)
  20 + if self.y > 110 then
  21 + self.y = self.y-120
  22 + elseif self.y < -10 then
  23 + self.y = self.y+120
  24 + elseif self.x > 110 then
  25 + self.x = self.x-120
  26 + else
  27 + self.x = self.x+120
  28 + end
  29 + end
  30 +end
  31 +
  32 +function star:draw()
  33 + local r, g, b = love.graphics.getColor()
  34 + love.graphics.setColor(255, 255, 255, 255*staralpha)
  35 + draw(starimg, self.x, self.y, 0, 1, 1, 4.5)
  36 + love.graphics.setColor(r, g, b)
  37 +end
0 38 \ No newline at end of file
... ...