Sound!!?!


Today I added sound, I can't believe that my game had no sound!?!

*********************

past: I added stupid AI (verry stupid)


*********************

present: The sound is temporary I probably will make my own sound for the big release. Currently I am using love2d for making my games,

love2d is based of lua, THE SUPIRIOR programing language.


*********************

The only code that I implemented was:

To load the code

sounds = {}     
sounds.step1 = love.audio.newSource("sounds/step1.mp3", "static")     
sounds.step2 = love.audio.newSource("sounds/step2.mp3", "static")     
sounds.coin1 = love.audio.newSource("sounds/coin1.mp3", "static")     
sounds.coin2 = love.audio.newSource("sounds/coin2.mp3", "static")     
sounds.hploose = love.audio.newSource("sounds/-1hp.mp3", "stream")     
sounds.bg_music = love.audio.newSource("sounds/music.mp3", "stream")  
    
sounds.bg_music:play()

Next to play the sounds

function step_sounds()     
local randome_food_sound = love.math.random(1,2)      
if randome_food_sound == 1 then         
sounds.step1:play()     
end     
if randome_food_sound == 2 then         
sounds.step2:play()     
end      
randome_food_sound = 0 
end
function coin_sounds()     
local randome_coin_sound = love.math.random(1,2)      
if randome_coin_sound == 1 then         
sounds.coin1:play()     
end     
if randome_coin_sound == 2 then         
sounds.coin2:play()     
end      
randome_coin_sound = 0 
end
for i,c in ipairs(humans) do     
if AABB(king.hitboxX,king.hitboxY,king.hitboxW,king.hitboxH,c.hx,c.hy,c.hw,c.hh) 
then         
sounds.hploose:play()         
table.remove(h_hitboxes,i)         
table.remove(humans,i)         
king.hp = king.hp - 1    
end 
end

Thats The end of this weeks devlog

Files

Game.zip 2.6 MB
Aug 03, 2022

Get Axolotl-Beta 0.34

Leave a comment

Log in with itch.io to leave a comment.