Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function love.load()
- userInput = 0
- jumpReady = 1
- room = 0
- timer1 = 1
- gilmoreHoriz = 0
- gilmoreVert = 0
- gilmoreWalk = 0
- animTimer = 100
- nGilX = 650/2
- nGilY = 650/2
- record = 1
- menu = 1
- pan = 1
- --
- love.physics.setMeter(64)
- world = love.physics.newWorld(0, 9.81*64, true)
- --
- images = {}
- --
- images.logo = love.graphics.newImage("resources/miscThings/logo.png")
- images.logo2 = love.graphics.newImage("resources/miscThings/logo2.png")
- images.logo3 = love.graphics.newImage("resources/miscThings/logo3.png")
- images.main = love.graphics.newImage("resources/miscThings/main.png")
- images.main2 = love.graphics.newImage("resources/miscThings/main2.png")
- images.main3 = love.graphics.newImage("resources/miscThings/main3.png")
- images.backLayer = love.graphics.newImage("resources/miscThings/backLayer.png")
- --
- music = {}
- --
- music.bossTheme = love.audio.newSource("resources/music/bossTheme.mp3")
- music.intro = love.audio.newSource("resources/music/intro.mp3")
- music.egg = love.audio.newSource("resources/music/intro.mp3")
- --
- sounds = {}
- --
- sounds.street = love.audio.newSource("resources/sounds/street.mp3")
- --
- sprites = {}
- --
- sprites.headOn = love.graphics.newImage("resources/gilmoreSprites/headOn.png")
- sprites.driftLeft = love.graphics.newImage("resources/gilmoreSprites/driftLeft.png")
- sprites.driftRight = love.graphics.newImage("resources/gilmoreSprites/driftRight.png")
- sprites.falling = love.graphics.newImage("resources/gilmoreSprites/falling.png")
- sprites.fallingUp = love.graphics.newImage("resources/gilmoreSprites/fallingUp.png")
- sprites.fallLeft = love.graphics.newImage("resources/gilmoreSprites/fallLeft.png")
- sprites.fallRight = love.graphics.newImage("resources/gilmoreSprites/fallRight.png")
- sprites.jettingUp = love.graphics.newImage("resources/gilmoreSprites/jettingUp.png")
- sprites.movingLeft = love.graphics.newImage("resources/gilmoreSprites/movingLeft.png")
- sprites.movingRight = love.graphics.newImage("resources/gilmoreSprites/movingRight.png")
- sprites.upLeft = love.graphics.newImage("resources/gilmoreSprites/upLeft.png")
- sprites.upRight = love.graphics.newImage("resources/gilmoreSprites/upRight.png")
- --
- objects = {}
- --
- -- objects.groundOne = {}
- -- objects.groundOne.body = love.physics.newBody(world, 650/2, 650/2)
- -- objects.groundOne.shape = love.physics.newRectangleShape(650, 50)
- -- objects.groundOne.fixture = love.physics.newFixture(objects.groundOne.body, objects.groundOne.shape);
- --
- objects.groundTwo = {}
- objects.groundTwo.body = love.physics.newBody(world, 1200/2, 675)
- objects.groundTwo.shape = love.physics.newRectangleShape(1200, 25)
- objects.groundTwo.fixture = love.physics.newFixture(objects.groundTwo.body, objects.groundTwo.shape);
- --
- objects.gilmore = {}
- objects.gilmore.body = love.physics.newBody(world, 1200/2, 600, "dynamic")
- objects.gilmore.shape = love.physics.newCircleShape(32)
- objects.gilmore.fixture = love.physics.newFixture(objects.gilmore.body, objects.gilmore.shape, 1)
- objects.gilmore.body:setAngularDamping(20)
- love.graphics.setBackgroundColor(145, 145, 145)
- love.window.setMode(1200, 675)
- --
- love.audio.play(music.intro)
- end
- function love.textinput( )
- if menu == 1 then
- room = 2
- menu = 0
- timer1 = 255
- end
- end
- function love.update(dt)
- world:update(dt)
- if pan == 1 and room == 3 and timer1 <= 400 and timer1 > 200 then
- timer1 = (timer1 - 1)
- elseif pan == 1 and room == 3 and timer1 <= 200 and timer1 > 0 then
- timer1 = (timer1 - 1)
- camera.y = (0 - timer1)
- elseif pan == 1 and room == 3 and timer1 == 0 then
- pan = 0
- end
- if pan == 0 and room == 3 then
- camera.x = (objects.gilmore.body:getX() + -1200/2)
- -- camera.y = (objects.gilmore.body:getY() + -675/2)
- end
- gilX = objects.gilmore.body:getX()
- gilY = objects.gilmore.body:getY()
- nGilX = (nGilX - gilX)
- nGilY = (nGilY - gilY)
- deltaGil1 = (nGilX + nGilY)
- deltaGil = (deltaGil1 / 2)
- -- Animation Timer Start
- if room > 0 then
- if animTimer <= 255 and animTimer > 0 then
- animTimer = (animTimer - 5)
- elseif animTimer == 0 then
- animTimer = 255
- end
- end
- --Animation Timer End
- if deltaGil > 500 or deltaGil < -500 then
- freakout = 0
- elseif deltaGil < 500 and deltaGil > -500 then
- freakout = 1
- end
- gilmoreHoriz, gilmoreVert = objects.gilmore.body:getLinearVelocity()
- if gilmoreHoriz > 500 then
- objects.gilmore.body:setLinearVelocity(500, gilmoreVert)
- elseif gilmoreHoriz < -500 then
- objects.gilmore.body:setLinearVelocity(-500, gilmoreVert)
- end
- if love.keyboard.isDown("right") then
- objects.gilmore.body:applyForce(500, 0)
- gilmoreWalk = 1
- if love.keyboard.isDown("up") and gilmoreVert == 0 then
- objects.gilmore.body:applyLinearImpulse(0, -400)
- end
- elseif love.keyboard.isDown("left") then
- objects.gilmore.body:applyForce(-500, 0)
- gilmoreWalk = 1
- if love.keyboard.isDown("up") and gilmoreVert == 0 then
- objects.gilmore.body:applyLinearImpulse(0, -400)
- end
- elseif love.keyboard.isDown("up") and gilmoreVert == 0 then
- objects.gilmore.body:applyLinearImpulse(0, -400)
- gilmoreWalk = 1
- elseif not love.keyboard.isDown("right") or not love.keyboard.isDown("left") or not love.keyboard.isDown("up") then
- gilmoreWalk = 0
- if gilmoreHoriz < 5 or gilmoreHoriz > -5 then
- objects.gilmore.body:setLinearVelocity(0, gilmoreVert)
- end
- end
- if record == 1 and gilX > 700/2 then
- -- love.audio.play(music.bossTheme)
- record = 0
- end
- end
- function love.draw()
- if room == 3 then
- camera:set()
- --
- love.graphics.draw(images.backLayer, 0, 0, 0, 0.625, 0.625, 0, 0, 0, 0)
- --
- love.graphics.setColor(50, 50, 50)
- -- love.graphics.polygon("fill", objects.groundOne.body:getWorldPoints(objects.groundOne.shape:getPoints()))
- --
- love.graphics.setColor(50, 50, 50)
- love.graphics.polygon("fill", objects.groundTwo.body:getWorldPoints(objects.groundTwo.shape:getPoints()))
- --
- love.graphics.setColor(255, 255, 255)
- -- Gilmore Animation Core Start
- if freakout == 0 then
- if gilmoreHoriz == 0 and gilmoreVert == 0 then
- love.graphics.draw(sprites.headOn, objects.gilmore.body:getX(), objects.gilmore.body:getY(), 0, 1, 1, 0, 0, 0, 0)
- elseif gilmoreHoriz > -3 and gilmoreVert == 0 and gilmoreWalk == 0 then
- love.graphics.draw(sprites.driftRight, objects.gilmore.body:getX(), objects.gilmore.body:getY(), 0, 4, 4, 0, 0, 0, 0)
- elseif gilmoreHoriz < 3 and gilmoreVert == 0 and gilmoreWalk == 0 then
- love.graphics.draw(sprites.driftLeft, objects.gilmore.body:getX(), objects.gilmore.body:getY(), 0, 4, 4, 0, 0, 0, 0)
- elseif gilmoreHoriz == 0 and gilmoreVert > 0 then
- love.graphics.draw(sprites.falling, objects.gilmore.body:getX(), objects.gilmore.body:getY(), 0, 4, 4, 0, 0, 0, 0)
- elseif gilmoreHoriz == 0 and gilmoreVert < 0 and gilmoreWalk == 0 then
- love.graphics.draw(sprites.fallingUp, objects.gilmore.body:getX(), objects.gilmore.body:getY(), 0, 4, 4, 0, 0, 0, 0)
- elseif gilmoreHoriz > 0 and gilmoreVert == 0 and gilmoreWalk == 1 then
- love.graphics.draw(sprites.movingRight, objects.gilmore.body:getX(), objects.gilmore.body:getY(), 0, 4, 4, 0, 0, 0, 0)
- elseif gilmoreHoriz < 0 and gilmoreVert == 0 and gilmoreWalk == 1 then
- love.graphics.draw(sprites.movingLeft, objects.gilmore.body:getX(), objects.gilmore.body:getY(), 0, 4, 4, 0, 0, 0, 0)
- elseif gilmoreHoriz == 0 and gilmoreVert < 0 and gilmoreWalk == 1 then
- love.graphics.draw(sprites.jettingUp, objects.gilmore.body:getX(), objects.gilmore.body:getY(), 0, 4, 4, 0, 0, 0, 0)
- elseif gilmoreHoriz > 0 and gilmoreVert > 0 then
- love.graphics.draw(sprites.fallRight, objects.gilmore.body:getX(), objects.gilmore.body:getY(), 0, 4, 4, 0, 0, 0, 0)
- elseif gilmoreHoriz < 0 and gilmoreVert > 0 then
- love.graphics.draw(sprites.fallLeft, objects.gilmore.body:getX(), objects.gilmore.body:getY(), 0, 4, 4, 0, 0, 0, 0)
- elseif gilmoreHoriz < 0 and gilmoreVert < 0 then
- love.graphics.draw(sprites.upLeft, objects.gilmore.body:getX(), objects.gilmore.body:getY(), 0, 4, 4, 0, 0, 0, 0)
- elseif gilmoreHoriz > 0 and gilmoreVert < 0 then
- love.graphics.draw(sprites.upRight, objects.gilmore.body:getX(), objects.gilmore.body:getY(), 0, 4, 4, 0, 0, 0, 0)
- end
- elseif freakout == 1 then
- love.graphics.draw(sprites.headOn, objects.gilmore.body:getX(), objects.gilmore.body:getY(), 0, 1, 1, 0, 0, 0, 0)
- end
- -- Gilmore Animation Core End
- camera:unset()
- elseif room == 0 then
- timer1 = (.969 + timer1)
- if timer1 < 255 then
- love.graphics.setColor(timer1, timer1, timer1)
- love.graphics.setBackgroundColor(timer1, timer1,timer1)
- love.graphics.draw(images.logo, 284.468, 0, 0, 1.337, 1.337, 0, 0, 0, 0)
- elseif timer1 > 255 and timer1 < 510 then
- love.graphics.setBackgroundColor(0, 0, 0)
- love.graphics.setColor(timer1-255, timer1-255, timer1-255)
- love.graphics.draw(images.logo2, 262.5, 0, 0, 1.32, 1.32, 0, 0, 0, 0)
- elseif timer1 > 510 and timer1 < 765 then
- love.graphics.setColor(timer1-510, timer1-510, timer1-510)
- love.graphics.draw(images.logo3, 0, 0, 0, 2.344, 2.344, 0, 0, 0, 0)
- elseif timer1 > 765 and timer1 < 850 then
- love.graphics.draw(images.logo3, 0, 0, 0, 2.344, 2.344, 0, 0, 0, 0)
- elseif timer1 > 850 then
- room = 1
- end
- elseif room == 1 then
- love.graphics.setColor(255, 255, 255)
- love.graphics.draw(images.main, 0, 0, 0, 1, 1, 0, 0, 0, 0)
- love.graphics.draw(images.main2, 350, 200, 0, 1.5, 1.5, 0, 0, 0, 0)
- love.graphics.setColor(animTimer, animTimer, animTimer)
- love.graphics.draw(images.main3, 450, 350, 0, 1, 1, 0, 0, 0, 0)
- end
- if room == 2 then
- if timer1 <= 255 and timer1 > 0 then
- love.graphics.setColor(timer1, timer1, timer1)
- love.audio.setVolume(timer1/255)
- love.graphics.draw(images.main, 0, 0, 0, 1, 1, 0, 0, 0, 0)
- love.graphics.draw(images.main2, 350, 200, 0, 1.5, 1.5, 0, 0, 0, 0)
- love.graphics.draw(images.main3, 450, 350, 0, 1, 1, 0, 0, 0, 0)
- timer1 = (timer1 - 1)
- elseif timer1 == 0 then
- room = 3
- love.graphics.setBackgroundColor(100, 100, 100)
- love.audio.stop(music.intro)
- love.audio.setVolume(1)
- timer1 = 400
- love.audio.play(sounds.street)
- camera.y = -200
- end
- end
- end
- -- Camera Core Start
- camera = {}
- camera.x = 0
- camera.y = 0
- camera.scaleX = 1
- camera.scaleY = 1
- camera.rotation = 0
- function camera:set()
- love.graphics.push()
- love.graphics.rotate(-self.rotation)
- love.graphics.scale(1 / self.scaleX, 1 / self.scaleY)
- love.graphics.translate(-self.x, -self.y)
- end
- function camera:unset()
- love.graphics.pop()
- end
- function camera:move(dx, dy)
- self.x = self.x + (dx or 0)
- self.y = self.y + (dy or 0)
- end
- function camera:rotate(dr)
- self.rotation = self.rotation + dr
- end
- function camera:scale(sx, sy)
- sx = sx or 1
- self.scaleX = self.scaleX * sx
- self.scaleY = self.scaleY * (sy or sx)
- end
- function camera:setPosition(x, y)
- self.x = x or self.x
- self.y = y or self.y
- end
- function camera:setScale(sx, sy)
- self.scaleX = sx or self.scaleX
- self.scaleY = sy or self.scaleY
- end
- -- Camera Core End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement