please put tutorial that bg music works
knightansbert7

Admins sorry for making thread again but,please put tutorial that bg music works on android... because my wc3.ogg is not working.. check my attachments. thank you . my final defense is on this day :(

Comments 16 to 30 (72 total)
knightansbert7

and if its correct the score will add 1

Gio

Instead of wade.playAudio('its_paper.ogg');

try this:

wade.playAudio('its_' + wade.app.dragging.type + '.ogg');

As for the score, it should be very similar to what you did for another scene, where you created a scoreText object. You can do the same again or, more conveniently, click the import button on the top bar. It looks like this: 

Select your scene that already contains scoreTet, and then the scoreText object - this will create a copy of it in the current scene.

Edit its onAddToScene function, and type in this code:

this.getSprite().setText(wade.app.score || 0);

Then when the score is correct (in your if statement above)

_.scoreText.getSprite().setText(++wade.app.score);

 

knightansbert7

if (wade.app.dragging)
{
    if (wade.app.dragging.type == this.type)
    {
        wade.removeSceneObject(wade.app.dragging);

        wade.playAudio('correct.ogg');
        // here you can insert code for whatever you want to happen
        // when the player drags the piece of garbage into the bin
    }
    else
    {
        // the wrong type was selected - display a message?
     wade.playAudio('its_' + wade.app.dragging.type + 'paper.ogg');
     wade.removeSceneObject(wade.app.dragging);
        
    }
}

not working

Gio

Nope, it wouldn't work like that... try copying and pasting the code I posted above

knightansbert7

when i put glass on plastic bin its working .. it plays audio its_glass.ogg   ...   but not in paper and plastic objects

knightansbert7
wade.playAudio('its_' + wade.app.dragging.type + '.ogg');
i dont understand how this works
Gio

Right, the value of wade.app.dragging.type is the value of the type property of the object that you are dragging. 

So if the type of the object that you are dragging is glass, wade.app.dragging.type == 'glass'.

If the type of the object that you are dragging is paper, wade.app.dragging.type == 'paper'.

The code above creates a string that contains its_ followed by the type followed by .ogg

It then tries to play an audio file with that name.

Of course this can only work if you have audio files for each type, so its_glass.ogg, its_plastic.ogg, etc.

knightansbert7

how about losing lifepoints when item put on the wrong bin

this.getSprite().setText(wade.app.lives || 3);    is that correct? 

knightansbert7

check my audio

Gio

Some of those files (e.g. Its_paper.ogg) start with an uppercase I. Some others (e.g. its_glass.ogg) start with a lowercase i.

Make sure that all of them start with a lowercase i. As it stands now, the code above tries to play a file called its_paper.ogg but it doesn't exist, because it's called Its_paper.ogg

knightansbert7

uhhh its working now sir... how about lifepoints

knightansbert7

in my scene5 before i drag the object can i put an audio? 

knightansbert7

if (wade.app.dragging)
{
    if (wade.app.dragging.type == this.type)
    {
        _.scoreText.getSprite().setText(++wade.app.score);
        wade.removeSceneObject(wade.app.dragging);

        wade.playAudio('correct.ogg');
        // here you can insert code for whatever you want to happen
        // when the player drags the piece of garbage into the bin
    }
    else
    {
        // the wrong type was selected - display a message?
     wade.playAudio('its_' + wade.app.dragging.type + '.ogg');
     wade.removeSceneObject(wade.app.dragging);
    
        
    }
}

why its_plastic audio is not working?

knightansbert7

its working now... sir how about on my lvl1 lvl2 lvl3 when i click the item i want an audio play like i click a notebook .. its will play notebook.ogg

knightansbert7

Got it.. Only lifepoints on lvl4 needed

Post a reply
Add Attachment
Submit Reply
Login to Reply