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 :(
2nd pic
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.
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?
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
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...
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);
}
}
I'll try it now sir gio.. Salamat
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
i see
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...
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"?
append
if paper= type paper
if plastic= type plastic
if glass= type glass
correct?
check this
what i mean was if a paper will put on the glass bin ... audio will play its_paper.ogg
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
and if its correct the score will add 1
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);
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
Nope, it wouldn't work like that... try copying and pasting the code I posted above
when i put glass on plastic bin its working .. it plays audio its_glass.ogg ... but not in paper and plastic objects
wade.playAudio('its_' + wade.app.dragging.type + '.ogg');
i dont understand how this works
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.
how about losing lifepoints when item put on the wrong bin
this.getSprite().setText(wade.app.lives || 3); is that correct?
check my audio
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
uhhh its working now sir... how about lifepoints
in my scene5 before i drag the object can i put an audio?
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?
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
Got it.. Only lifepoints on lvl4 needed
hey sir lifepoints is ok now.. but i dont know how if the score in drag item will get 10 it will open congratzMessage.. its deifferent in finding object true
sir how to do it when the score in dragging items gets 10 it will visible the congratz message asap
If you have an object called congratzMessage and that object is initially set to be invisible, then where you do _.scoreText.getSprite().setText(++wade.app.score); you could do this
_.scoreText.getSprite().setText(++wade.app.score);
if (wade.app.score == 10)
{
_.congratzMessage.setVisible(true);
}
Where shud i put that?
where you do _.scoreText.getSprite().setText(++wade.app.score);
On my scoreText object addtoscenefunction?
I believe you are doing that on the bin's onMouseUp function
Uhhh thats where i got wrong.. I put if statement but i didnt put the get sprite.. I screwed up in debugging 😭
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');
_.scoreText.getSprite().setText(++wade.app.score);
if (wade.app.score == 10)
{
_.congratzMessage.setVisible(true);
}
}
else
{
// the wrong type was selected - display a message?
wade.playAudio('its_' + wade.app.dragging.type + '.ogg');
wade.removeSceneObject(wade.app.dragging);
--wade.app.lives;
_.lifeText.getSprite().setText(wade.app.lives);
if(wade.app.lives === 0)
{
wade.clearScene();
wade.loadScene('gameOver.wsc'); // I'm just clearing scene
// No lives left, end game
// restart or anything else you want
}
}
}
i think theres something wrong?
Yes
Go back to what you had before. Just replace
_.scoreText.getSprite().setText(++wade.app.score);
with the code that I posted above
Go back to what you had before. <--- i dont understand sir
You've just made a change and realized that it didn't work.
Go back to what you had before means "undo that change you've just made"
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');
}
else
{
// the wrong type was selected - display a message?
wade.playAudio('its_' + wade.app.dragging.type + '.ogg');
wade.removeSceneObject(wade.app.dragging);
--wade.app.lives;
_.lifeText.getSprite().setText(wade.app.lives);
if(wade.app.lives === 0)
{
wade.clearScene();
wade.loadScene('gameOver.wsc'); // I'm just clearing scene
// No lives left, end game
// restart or anything else you want
}
}
}
this code works but no if wadeapp score===10 set congratzmessageVisible
Right, now you've gone back to what you had before...
Just replace
_.scoreText.getSprite().setText(++wade.app.score);
with the code that I posted above
if (wade.app.dragging)
{
if (wade.app.dragging.type == this.type)
{
_.scoreText.getSprite().setText(++wade.app.score);
if (wade.app.score == 10)
{
_.congratzMessage.setVisible(true);
}
wade.removeSceneObject(wade.app.dragging);
wade.playAudio('correct.ogg');
}
else
{
// the wrong type was selected - display a message?
wade.playAudio('its_' + wade.app.dragging.type + '.ogg');
wade.removeSceneObject(wade.app.dragging);
--wade.app.lives;
_.lifeText.getSprite().setText(wade.app.lives);
if(wade.app.lives === 0)
{
wade.clearScene();
wade.loadScene('gameOver.wsc'); // I'm just clearing scene
// No lives left, end game
// restart or anything else you want
}
}
}
correct?
in 3 bins right? mouse up
uncaught typeerror: cannot read property 'setVisible' of undefined (Sceneobjec,
i t hink its bug because when i made again a congratzMessage it worked
sir gio i just want to thank you and let you know that my next project is like angrybird like the unicorn in tutorial :D
http://www.filehosting.org/file/details/651806/Master%20%20Cleaner%20%20%20Final.zip sir kindly check my project ... theres some error on other scenes that you only can fixed but its workingly fine.. kindly check it sir thank you... ill wait
could you fix that sir coz its stuck at loading screen scene1 to scene2 in my android phone
sir?
It worked for me, I didn't see any problem.
What happens exactly? You click to go to the next level, the loading bar appears and then it gets stuck? At what point does it get stuck?
on android package.. when i click start... it just loading
This sir
As it does work on my phone, I'm not really able to tell you what's wrong with it... the best thing you can do is some debugging, that is create a copy of the scene that fails to load (right-click the file and select Duplicate File), then start simplifying it. It is almost certainly a case of it failing to load some asset... so I would start removing assets from it until it works. Then you will know which image / sound is causing a problem on your phone.
I uninstalled all apk's of my game .. And also i will try your suggestion thank you
},
"scripts": [
"hiddenObject.js",
"hiddenObject.js"
i found this on my scene3
I dont know how that has been added twice, but you can remove one of those lines. Including the same script twice doesn't make sense, but I dont think it would cause any bugs
could you check my files? why is it bug on my phone
where to get the assets of your loppy bird game like tutorial .. that unicorn
Hi
You can download the flying unicorn animation here
I believe for the background we used one of the landscapes in the 2d art pack on our downloads page
I am not sure where the boxes came from though
thank you ill try to make one also
sir how to put score and game over?
how to .. like when u open the game then there will be a welcome animated text before the game menu
Can you check this thread to see if it answers your questions?
i want my 1st scene to view animated text then game menu
Could you split the two things? That is, have a scene with your animated text, and when the animation is finished you load the scene with the game menu. For the game menu itself, you can do the same thing you did for your previous game.
For the animated text, I'm going to need some more info. Animated how exactly?
just like a welcoming animation text ..
how to make this jumping on the screen.. i will just put this on game menu
You could create a Path (define it as you want, you can decide where it goes exactly, how quickly, etc), then set your object on the path.
Please refer to this youtube video:
{Spam comment removed}
How you remove my comment?