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 1 to 15 (72 total)
knightansbert7

2nd pic

foxcode

Where it says "Code for this box(click to show)" can you click it, I just want to make sure it's what it's supposed to be.
By the sounds of it the music works fine on pc not android.

Unfortunately it's possible that either the device or browser you are using does not support web audio yet, it is still a relatively new feature. On mobile devices especially, support for it differs widly depending on the browser. If that's the case, it's not something we can solve in code.

knightansbert7

Audio problems is fix now sir fox.  But my game needs 1 more lvl where i can drag the item into thee right recycling bin. Can u help me?

Gio

For each item that you want the player to drag, go to the Functions tab and then select onMouseDown. Paste this code in there:

wade.app.dragging = this;

Then edit app.js. At line 3 (just above this.init = ... ) insert this code:

this.onMouseUp = function()
{
    wade.app.dragging = null;
};

this.onMouseMove = function(data)
{
    if (wade.app.dragging)
    {
        wade.app.dragging.setPosition(data.screenPosition);
    }
};

Finally for the recycle bin, edit the onMouseUp function and paste this code in there:

if (wade.app.dragging)
{
    wade.removeSceneObject(wade.app.dragging);

    // here you can insert code for whatever you want to happen
    // when the player drags the piece of garbage into the bin
}

EDIT: sorry I had missed one bit - updated the code above

knightansbert7

How about the garbage that dragged on the wrong bin.... Like for example a paper is dragged on the glass bin .... Then it will say . opps its paper..and then if a bottle item is dragged on the paper bin ..it will say opps its glass... How to do it on every objects?.  Maybe ill put again lifepoints so that there will be a game over. Then a score... 

Gio

You could add a custom property to each piece of garbage, called type (this is done in the Properties tab). Set the value to glass, paper, etc. as appropriate.

You could do the same for your bins, i.e. add a type property.

The onMouseUp functions of your bins will then look like this

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

        // 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?
        alert('oops, that was ' + wade.app.dragging.type);
    }
}

 

knightansbert7

I'll try it now sir gio.. Salamat

knightansbert7

how to add score when object is correctly put into the right bin? and how to lose a lifepoints when the object is put in the wrong bin 

knightansbert7

i see

knightansbert7

sir how does the bin knew .. for example ... notebook is put on glass bin it say opss its paper.. then how about a plastic bottle is put in glass bin .. it says same? with paper?  i want it to say opss its plastic...

Gio

I am pretty sure that this should happen already. The message depends on the "type" property of the object that you are dragging.

Are you definitely sure that you have set the type property of your plastic bottle to "plastic"?

knightansbert7

append

if paper= type paper     

if plastic= type plastic

if glass= type glass

 

 

correct?

knightansbert7

check this

knightansbert7

what i mean was if a paper will put on the glass bin ... audio will play its_paper.ogg

 

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_paper.ogg');
    }
}

 

else is not working .. i want when the paper is put on plastic or glass bin ... it will play the wadeapp audio its_paper.ogg and the item will disappear and lifepoints -1   

 

 

 

Post a reply
Add Attachment
Submit Reply
Login to Reply