Jump to content

sam89

Members
  • Posts

    16
  • Joined

  • Last visited

Everything posted by sam89

  1. Thank you so much. Next time I will keep track on these things.
  2. Hi there. I need another guidance. For the game that I'm about to design, the player will be given 4 sounds and they have to guess what the sounds have in common. It works exactly as "4 pictures 1 word" game but instead of pictures, the player has to guess the sounds. How do I code the part where each time the player has heard the 4 sound, they would enter a particular word to guess it. As an example in level 1, player will be given the sound of cat,dog,parrot and hamster, and have to guess the common between the four sounds. The narration will say that the word consist of 3 word. Player will be inserting each alphabet till they get the correct one. The correct word for this will be "PET". How do I code this in Phaser? Thanks in advanced.
  3. Thank you so much, I got it working now.
  4. I'm having this error "Uncaught TypeError: undefined is not a function " at this particular code: this.addGuitar(); Thanks in advanced.
  5. Hi,thanks for the reply. I have applied the changes to the code based on your recommendation but the sound is not working. The error I am getting is "Uncaught TypeError: Cannot read property 'add' of undefined ". Below is my line of code. Thanks in advanced. main.js var game = new Phaser.Game(400,490, Phaser.AUTO, 'gameDiv'); var key1;var key2;var key3;var key4;var mainState = { preload: function() {game.stage.backgroundColor ='#71c5cf'game.load.audio('start', 'assets/guitar.wav');game.load.audio('second', 'assets/drum.wav');game.load.audio('third', 'assets/flute.wav');game.load.audio('fourth', 'assets/piano.wav');game.load.audio('default' , 'assets/test.wav'); }, create: function() {this.game.input.keyboard.onDownCallback = function(e) { var keycode = e.keycode || e.which; switch(keycode) { case Phaser.Keyboard.ONE: key1 = game.input.keyboard.addKey(Phaser.Keyboard.ONE); this.jumpSound = game.add.audio('start'); key1.onDownCallback.add(this.addGuitar, this); break; case Phaser.Keyboard.TWO: key2 = game.input.keyboard.addKey(Phaser.Keyboard.TWO); this.bangSound = game.add.audio('second'); key2.onDown.add(this.addDrum, this); break; case Phaser.Keyboard.THREE: key3 = game.input.keyboard.addKey(Phaser.Keyboard.THREE); this.melodySound = game.add.audio('third'); key3.onDown.add(this.addFlute, this); break; case Phaser.Keyboard.FOUR: key4 = game.input.keyboard.addKey(Phaser.Keyboard.FOUR); this.beethovenSound = game.add.audio('fourth'); key4.onDown.add(this.addPiano, this); break; default: this.noSound = game.add.audio('default'); } } }, update: function() { }, addGuitar: function() { this.jumpSound.play();}, addDrum: function() {this.bangSound.play();}, addFlute: function() {this.melodySound.play();}, addPiano: function() {this.beethovenSound.play();}, addOthers: function() {this.noSound.play();},}; game.state.add('main', mainState);game.state.start('main');
  6. Hi there. Now I want to make sure that if other keys ( which is key that is not 1 2 3 or 4), I would like a sound to be played to tell the player the key they press is wrong. Example will be when the player pressed key 5 or alphabet T, a sound will be played. This will apply to all the other keys as well. I understand how it works but I don't know how it works in a Phaser.
  7. Thanks Sebastian..! It works.. Thank you so much..!!
  8. Hi there. Sorry to bother again. I used the example as u send me but I'm having a problem now. The sound is not playing when i hit the key. The error I am getting is "addGuitar is not defined". Can please tell me what is wrong with it. Thank you so much in advanced. Below are the code for both in the index.html and the main.js index.html <html> <head><meta charset="utf-8"/><title>Recognise the Sounds</title> <script src= "build/phaser.js"></script> <script type="text/javascript" src="phaser.min.js"></script><script type="text/javascript" src="main.js"></script></head> <body> <div id="gameDiv"></div></body></html> main.js var game = new Phaser.Game(400,490, Phaser.AUTO, 'gameDiv'); var mainState = { preload: function() {game.stage.backgroundColor ='#71c5cf'game.load.audio('start', 'assets/guitar.wav');game.load.audio('second', 'assets/drum.wav'); }, var key1; create: function(){ key1 = game.input.keyboard.addKey(Phaser.Keyboard.ONE);this.jumpSound = game.add.audio('start');key1.onDown.add(addGuitar, this); }, update: function() { }, addGuitar: function() { this.jumpSound.play();},}; game.state.add('main', mainState);game.state.start('main');
  9. Thank you so much. I will give a look on the examples.
  10. Hi. I am actually new to the Phaser framework and I am developing a game for my final year project. The game I am developing would not have any graphics or animations because the game is for the blind users. It will be based on sound. I am wondering on how to assign keyboard input for each sounds? I want that when a user clicks a particular key and the sound plays. Also after a sound plays, I want the next sound to be played after the user input a key and not plays automatically. How am I to do this in Phaser? Thank you in advanced.
  11. sam89

    Audio Game

    Thanks Alex. Now I'm much clearer on what to do. If there is anything else,I will update here about it. Thanks again for the help.
  12. sam89

    Audio Game

    Okay thank you Alex. How about narration?
  13. sam89

    Audio Game

    The player's input will be the keyboard and mouse. The narration will guide the player if the player selects the wrong or correct input from the keyboard or mouse.
  14. sam89

    Audio Game

    I am doing an audio game for the visually impaired players. Is it possible to create audio game in HTML5 with narration and sound cues? The game will not have any visual.
×
×
  • Create New...