Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(2 edits) (+1)

I got a little problem ! 
I want to randomly play 4 sounds, but only when I'm on a specific card

I'm using this code on the script of my card

on loop do  
random["dove_1","dove_2","dove_3","dove_4"] 
end

But even when I'm moving to another card, the script keeps on playing randomly the 4 files.

How should I do to stop the sound playing when I'm not on my card ? 


EDIT : I found it ! I needed to add - play[0 "loop"] - when moving to another page ! sorry for this useless post 

(+1)

The default handler for the "loop" event provided by Decker looks like this:

on loop prev do
 prev
end

This handler is why the background loop plays forever by default; every time the loop ends, this function asks for the same sound to be played again.

If you write a deck-level script (File -> Properties -> Script...) which defines a replacement:

on loop do
 0
end

Then the loop will stop on all cards that do not have their own "on loop ... end" handler which overrides the above.

Does that make sense?

(+1)

absolutely !

(2 edits) (+1)

And how do I lock and unlock a button with a command ?
I tried 

on click do
card1.widgets.button1.locked.1
end

but I can see it's wrong

(sorry for being that level of noob)

EDIT : damn, again I found it : card1.widgets.button1.locked:1