Kaynağa Gözat

Sound effects

tags/6
Madiwka3 3 yıl önce
ebeveyn
işleme
8fbcd27eb2
27 değiştirilmiş dosya ile 90 ekleme ve 20 silme
  1. BIN
      entities/camera/button01.mp3.flac
  2. BIN
      entities/camera/button02.mp3.flac
  3. BIN
      entities/camera/button03.mp3.flac
  4. BIN
      entities/camera/button04.mp3.flac
  5. BIN
      entities/camera/button05.mp3.flac
  6. BIN
      entities/music/menu.ogg
  7. BIN
      entities/music/play.wav
  8. BIN
      entities/planet/asteroid.png
  9. BIN
      entities/planet/boom.wav
  10. BIN
      entities/planet/close.wav
  11. +10
    -0
      entities/planet/planet.lua
  12. BIN
      entities/ship/Appear.wav
  13. BIN
      entities/ship/Finish.wav
  14. +2
    -2
      entities/ship/ship.lua
  15. +2
    -2
      levels/level1.lua
  16. +2
    -2
      levels/level2.lua
  17. +4
    -3
      levels/level3.lua
  18. +2
    -2
      levels/level4.lua
  19. +5
    -5
      levels/level5.lua
  20. +2
    -0
      levels/levelgeneral.lua
  21. +15
    -1
      levels/practice.lua
  22. +2
    -1
      main.lua
  23. +1
    -0
      src/GUI.lua
  24. +1
    -0
      src/dependencies.lua
  25. +6
    -2
      src/mainMenu.lua
  26. +35
    -0
      src/musicController.lua
  27. +1
    -0
      stateMachine.lua

BIN
entities/camera/button01.mp3.flac Dosyayı Görüntüle


BIN
entities/camera/button02.mp3.flac Dosyayı Görüntüle


BIN
entities/camera/button03.mp3.flac Dosyayı Görüntüle


BIN
entities/camera/button04.mp3.flac Dosyayı Görüntüle


BIN
entities/camera/button05.mp3.flac Dosyayı Görüntüle


BIN
entities/music/menu.ogg Dosyayı Görüntüle


BIN
entities/music/play.wav Dosyayı Görüntüle


BIN
entities/planet/asteroid.png Dosyayı Görüntüle

Önce Sonra
Genişlik: 300  |  Yükseklik: 300  |  Boyut: 62 KiB

BIN
entities/planet/boom.wav Dosyayı Görüntüle


BIN
entities/planet/close.wav Dosyayı Görüntüle


+ 10
- 0
entities/planet/planet.lua Dosyayı Görüntüle

@@ -2,10 +2,13 @@ planet = Class{}

G = 6.67e-1


function planet:init(x, y, mass, radius, img, arg)
self.x = x
self.y = y
self.mass = mass
self.attractionX = 0
self.attractionY = 0
self.r = radius
self.w = img:getWidth()
self.image = img
@@ -19,6 +22,7 @@ end
end

function planet:update(dt)
if not reachedGoal then
local distanceToShip = math.sqrt((firstShip.x - self.x)^2 + (firstShip.y - self.y)^2)
local gravitationalAttraction = G*self.mass/(distanceToShip^2)
@@ -33,9 +37,15 @@ function planet:update(dt)
love.window.setTitle(self.attractionX)
firstShip.dx = firstShip.dx + self.attractionX
firstShip.dy = firstShip.dy + self.attractionY
if distanceToShip < 100 then
sounds["close"]:play()
end
if distanceToShip < self.w/4 then
shipIsHit = true
sounds["close"]:stop()
sounds["boom"]:play()
end
end
end

function planet:draw()


BIN
entities/ship/Appear.wav Dosyayı Görüntüle


BIN
entities/ship/Finish.wav Dosyayı Görüntüle


+ 2
- 2
entities/ship/ship.lua Dosyayı Görüntüle

@@ -30,7 +30,7 @@ function ship:update(dt)
if not shipIsHit then
self.dottimer = self.dottimer - dt
if self.dottimer < 0 then
if (love.keyboard.isDown('w') and self.fuel > 0) then
if (love.keyboard.isDown('w') and self.fuel > 0 and gameState == "levelgeneral") then
table.insert(self.path, self:newPathDot(self.x, self.y, 1))
else
table.insert(self.path, self:newPathDot(self.x, self.y, 2))
@@ -53,7 +53,7 @@ function ship:update(dt)
self.dx = math.cos(self.vector) * self.speed
self.dy = math.sin(self.vector) * self.speed
end ]]--
if love.keyboard.isDown('w') and self.fuel > 0 then
if love.keyboard.isDown('w') and self.fuel > 0 and gameState == "levelgeneral" then
self.fuel = self.fuel - 0.5
self.speed = self.speed + 0.05



+ 2
- 2
levels/level1.lua Dosyayı Görüntüle

@@ -31,7 +31,7 @@ function level1.load()
table.insert(guibutts, menu:addButton("To menu", function ()
level.goBack()
end))
table.insert(planets, planet(700, 200, 50, 0.3, planetImage, "nodelete"))
table.insert(planets, planet(700, 200, 50, 0.3, asteroidImage, "nodelete"))
end
function level1.hint()
GUIDraw("left")
@@ -49,7 +49,7 @@ function level1.reset()
planets[k] = nil
end
local planetImage = love.graphics.newImage("entities/planet/planet" .. math.random(1, 18) .. ".png")
table.insert(planets, planet(700, 200, 50, 0.3, planetImage))
table.insert(planets, planet(700, 200, 50, 0.3, asteroidImage))
shipsleft = 1
shipIsHit = false
firstShip.fuel = 25


+ 2
- 2
levels/level2.lua Dosyayı Görüntüle

@@ -31,7 +31,7 @@ function level2.load()
table.insert(guibutts, menu:addButton("To menu", function ()
level2.goBack()
end))
table.insert(planets, planet(700, 500, 50, 0.3, planetImage, "nodelete"))
table.insert(planets, planet(700, 500, 50, 0.3, asteroidImage, "nodelete"))
end
function level2.reset()
firstShip:reset()
@@ -40,7 +40,7 @@ function level2.reset()
end
firstShip.fuel = 50
local planetImage = love.graphics.newImage("entities/planet/planet" .. math.random(1, 18) .. ".png")
table.insert(planets, planet(700, 500, 50, 0.3, planetImage))
table.insert(planets, planet(700, 500, 50, 0.3, asteroidImage))
shipsleft = 1
shipIsHit = false
planetsleft = 3


+ 4
- 3
levels/level3.lua Dosyayı Görüntüle

@@ -31,9 +31,9 @@ function level3.load()
table.insert(guibutts, menu:addButton("To menu", function ()
levelgeneral.goBack()
end))
table.insert(planets, planet(900, 400, 50, 0.3, planetImage, "nodelete"))
table.insert(planets, planet(700, 300, 50, 0.3, planetImage, "nodelete"))
table.insert(planets, planet(900, 200, 50, 0.3, planetImage, "nodelete"))
table.insert(planets, planet(900, 400, 50, 0.3, asteroidImage, "nodelete"))
table.insert(planets, planet(700, 300, 50, 0.3, asteroidImage, "nodelete"))
table.insert(planets, planet(900, 200, 50, 0.3, asteroidImage, "nodelete"))
end
function level3.hint()
GUIDraw("left")
@@ -57,6 +57,7 @@ function level3.reset()
firstShip.fuel = 75
shipIsHit = false
planetsleft = 3
end
function level3.GUIControl()
if (love.keyboard.isDown('a') and VCAM.x > WINDOW_WIDTH/2) then


+ 2
- 2
levels/level4.lua Dosyayı Görüntüle

@@ -31,8 +31,8 @@ function level4.load()
table.insert(guibutts, menu:addButton("To menu", function ()
levelgeneral.goBack()
end))
table.insert(planets, planet(-200, 400, 50, 0.3, planetImage, "nodelete"))
table.insert(planets, planet(-200, 200, 50, 0.3, planetImage, "nodelete"))
table.insert(planets, planet(-200, 400, 50, 0.3, asteroidImage, "nodelete"))
table.insert(planets, planet(-200, 200, 50, 0.3, asteroidImage, "nodelete"))
end

function level4.reset()


+ 5
- 5
levels/level5.lua Dosyayı Görüntüle

@@ -4,7 +4,7 @@ local M = {}
function level5.load()
shipsleft = 1
local planetImage = love.graphics.newImage("entities/planet/planet" .. math.random(1, 18) .. ".png")
planetsleft = 5
planetsleft = 10
gameStatus = "setup"
playbutts = {}
guibutts = {}
@@ -31,9 +31,9 @@ function level5.load()
table.insert(guibutts, menu:addButton("To menu", function ()
levelgeneral.goBack()
end))
table.insert(planets, planet(0, 2000, 50, 0.3, planetImage, "nodelete"))
table.insert(planets, planet(100, 2000, 50, 0.3, planetImage, "nodelete"))
table.insert(planets, planet(50, 1700, 50, 0.3, planetImage, "nodelete"))
table.insert(planets, planet(0, 2000, 50, 0.3, asteroidImage, "nodelete"))
table.insert(planets, planet(100, 2000, 50, 0.3, asteroidImage, "nodelete"))
table.insert(planets, planet(50, 1700, 50, 0.3, asteroidImage, "nodelete"))
end

function level5.reset()
@@ -47,7 +47,7 @@ function level5.reset()
shipsleft = 1
firstShip.fuel = 100
shipIsHit = false
planetsleft = 5
planetsleft = 10
end
function level5.GUIControl()
if (love.keyboard.isDown('w') and VCAM.y > -WINDOW_WIDTH) then


+ 2
- 0
levels/levelgeneral.lua Dosyayı Görüntüle

@@ -4,6 +4,7 @@ local M = {}
local thrusterMax = 0
local animationComplete = false
local frame = 0
asteroidImage = love.graphics.newImage("entities/planet/asteroid.png")
function levelgeneral.update(dt)
if not levelLoaded then
level = require("levels/level" .. currentLevel)
@@ -81,6 +82,7 @@ function levelgeneral.draw()
love.graphics.clear(0,0,0,1)
love.graphics.setColor(30/255, 30/255, 30/255, 1)
if frame < WINDOW_WIDTH then
sounds["finish"]:play()
love.graphics.circle("fill", firstShip.x, firstShip.y, WINDOW_WIDTH - frame)
end
frame = frame + 20


+ 15
- 1
levels/practice.lua Dosyayı Görüntüle

@@ -1,6 +1,7 @@
practice = Class{}
local levelLoaded = false
local M = {}
local currenctScore = 0
function practice.update(dt)
if not levelLoaded then
shipsleft = 1
@@ -9,7 +10,10 @@ function practice.update(dt)
playbutts = {}
guibutts = {}
XCAM = 0
currentScore = 0
thrusterMax = 0
YCAM = 0
firstShip.fuel = 0
explosions = {}
shipIsHit = false
guimenu = mainMenu()
@@ -31,7 +35,6 @@ function practice.update(dt)
levelLoaded = true
end
camera:update(dt)
--print(camera.x .. " " .. camera.y)
for i, explosion in ipairs(explosions) do
explosion:update(dt)
@@ -54,6 +57,7 @@ function practice.update(dt)
for i in ipairs(planets) do
planets[i]:update(dt)
end
currentScore = currentScore + math.sqrt(firstShip.dx^2 + firstShip.dy^2)
else
camera:follow(VCAM.x, VCAM.y)
end
@@ -81,7 +85,10 @@ function practice.draw()
if gameStatus == "setup" then
GUIDraw("anywhere")
practice.hint()
elseif gameStatus == "play" then
local textW = tinyfont:getWidth("Score: " .. math.floor(currentScore/100))
love.graphics.print("Score: " .. math.floor(currentScore/100), WINDOW_WIDTH/2-textW/2, 10)
guimenu:butt(playbutts, WINDOW_WIDTH, WINDOW_HEIGHT, 1100, WINDOW_HEIGHT-50, 40, WINDOW_WIDTH/3)
love.keyboard.mouseisReleased = false
end
@@ -102,8 +109,13 @@ function practice.reset()
planets[k] = nil
end
shipsleft = 1
if currentScore > saveData.score then
saveData.score = currentScore
end
currentScore = 0
shipIsHit = false
planetsleft = 10
firstShip.fuel = 99999
end
function practice.GUIControl()
if (love.keyboard.isDown('w')) then
@@ -125,6 +137,8 @@ function practice.hint()
love.graphics.print("↓[S]",50,100)
love.graphics.print("←[A]",10,50)
love.graphics.print("→[D]",100,50)

end
return practice

+ 2
- 1
main.lua Dosyayı Görüntüle

@@ -15,7 +15,8 @@ OFFSET_Y = 0
currentLevel = 0

saveData = {
levelsBeaten = 0
levelsBeaten = 0,
score = 0
}

planets = {}


+ 1
- 0
src/GUI.lua Dosyayı Görüntüle

@@ -45,6 +45,7 @@ function GUIDraw(mode)
love.keyboard.mouseisReleased = false
firstShip.x = vmx
firstShip.y = vmy
sounds["appear"]:play()
shipsleft = shipsleft - 1
end
if shipsleft == 0 then


+ 1
- 0
src/dependencies.lua Dosyayı Görüntüle

@@ -11,6 +11,7 @@ require 'src/GUI'
require 'stateMachine'
require 'entities/base/base'
require 'entities/camera/VCAM'
require 'src/musicController'
tick = require 'src/tick'
utf8 = require("utf8")
serialize = require 'src/ser'

+ 6
- 2
src/mainMenu.lua Dosyayı Görüntüle

@@ -15,7 +15,7 @@ function mainMenu:butt(buttons, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, locationx, locati
local my = my * DIFFERENCE_Y
local hot = (mx > ev_bx and mx < ev_bx + ev_button_width and my > ev_by and my < ev_by + ev_BUTTON_HEIGHT) and i
if (hot == i) then
color = {10, 10, 0, 255}
color = {10/255, 10/255, 10/255, 255}
end
button.now = love.keyboard.mouseisReleased
if location == "android" then
@@ -24,6 +24,7 @@ function mainMenu:butt(buttons, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, locationx, locati
if button.now and hot == i then
love.keyboard.mouseisReleased = false
button.fn()
musicController("click")
hot = false
break
end
@@ -36,7 +37,10 @@ function mainMenu:butt(buttons, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, locationx, locati
love.graphics.rectangle("fill", ev_bx,ev_by, ev_button_width, ev_BUTTON_HEIGHT)
love.graphics.setColor(0, 0, 0, 255)
local textW = smallfont:getWidth(button.text)
local textH = smallfont:getHeight(button.text)
local textH = smallfont:getHeight(button.text)
if hot == i then
love.graphics.setColor(1,1,1,255)
end
love.graphics.print(button.text, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5)
love.graphics.setColor(255, 255, 255, 255)
cursor_y = cursor_y + (ev_BUTTON_HEIGHT + margin)


+ 35
- 0
src/musicController.lua Dosyayı Görüntüle

@@ -0,0 +1,35 @@
sounds = {
["menu"] = love.audio.newSource("entities/music/menu.ogg", "static"),
["boom"] = love.audio.newSource("entities/planet/boom.wav", "static"),
["close"] = love.audio.newSource("entities/planet/close.wav", "static"),
["play"] = love.audio.newSource("entities/music/play.wav", "static"),
["appear"] = love.audio.newSource("entities/ship/Appear.wav", "static"),
["finish"] = love.audio.newSource("entities/ship/Finish.wav", "static")
}
mute = false
function musicController(orders, toggling)
if (orders == 'norm' and not mute) then
if (gameState == 'menu' or gameState == "selectlv") then
sounds['menu']:play()
elseif gameStatus == 'play' then
stopSounds()
sounds["play"]:play()
end
elseif orders == "mute" then
if toggling == 1 then
mute = true
else
mute = false
end
elseif orders == "click" then
-- print("entities/camera/button0" .. math.random(1, 5)..".mp3.flac")
local tempClick = love.audio.newSource("entities/camera/button0" .. math.random(1, 5)..".mp3.flac", "static")
tempClick:play()
end
end
function stopSounds()
for i, sound in ipairs(sounds) do
sound[i]:stop()
print("stopping sounds")
end
end

+ 1
- 0
stateMachine.lua Dosyayı Görüntüle

@@ -6,6 +6,7 @@ function stateUpdate(dt)
if love.keyboard.isDown('escape') then
love.event.quit()
end
musicController("norm")
end




Yükleniyor…
İptal
Kaydet