• Content count

  • Joined

  • Last visited

  1. Zenva tuts, worth it?

    I wouldn't recommend the Zenva course unless you're comfortable with Javascript. He has his own Javascript primer, which is really awful. I tried to comment on that inside his own comment boards and he deleted my comment, so that gives you an idea of how open he is to public criticism. The course modules are good once you're familiar with JS, and there are a lot of them to go through and learn concepts. The course is worth it on sale for $50, in my opinion. The audio in the courses is diabolical to any audio folks, and really frustrated me (as primarily an audio person) to be constantly riding the volume knob on my computer. Maybe to people who don't care about sound they won't bother, but to me it it is the difference between being professional and being amateur. This is very amateur audio.
  2. getting name of this variable

    I am trying to create an adventure game. Very new to Phaser and Js. I've been through multiple tutorials and am now trying to make my way on my own. If you imagine a stage that can be returned to at any time, I need to know if the coins on that stage were collected before. I can write individual functions for each coin successfully: var State1 = { preload: function(){ game.load.image('coin','coin.png'); }, create: function(){ //note these vars are declared in Main state numCoins = 0; //the array that will tell me if the coin has already been collected. that check hasn't been written yet. coinsCollected = []; this.coinText =game.add.text(, 30, numCoins, {font: "26px Amatic SC"}); //single coins to collect on the stage. trying 2 different ways to show, as button and as sprite this.coin1=game.add.button(600, 300, 'coin', this.getCoin1, this); var coin2 = game.add.sprite(350, 250, 'coin'); coin2.inputEnabled=true;, this); var coin3 = game.add.sprite(400, 100, 'coin'); coin3.inputEnabled=true;, this); }, getCoin1: function(coin){ numCoins ++; this.coinText.text=numCoins; //which coins have been collected coinsCollected.push('coin1'); console.log(coinsCollected); coin.kill(); }, getCoin2: function(coin){ numCoins ++; this.coinText.text=numCoins; coinsCollected.push('coin2'); console.log(coinsCollected); coin.kill(); }, So that works fine, but obviously I don't want to write out a hundred "getCoin" functions. How do I pass the name of the coin to a single getCoin function so I can store it in an array? so getCoin: function(coin){ numcoins ++; this.coinText.text=numCoins; coinsCollected.push(coinNAME); }