Search the Community

Showing results for tags 'argument'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Platform
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 5 results

  1. I have this code: scene.physics.add.overlap(spears.children.entries[numberOfSpearThrowerMachines], platforms, stopSpear, null, this); function stopSpear(number) { spears.children.entries[number].setVelocityX(0); } I am trying to send a parameter to the function stopSpear when calling it. Like this: scene.physics.add.overlap(spears.children.entries[numberOfSpearThrowerMachines], platforms, stopSpear(numberOfSpearThrowerMachines), null, this); but this does not work obviously, so how do I do it instead?
  2. Greetings, Quick question: How do I dynamically update the arguments of this loop from the update function to reflect the actual coordinates of the pointer? (This loop is found in the create() function) Game.mouseTimer = game.time.events.loop( 100, Client.sendMousePos, Client.class, game.input.mousePointer.x, game.input.mousePointer.y ); I have already attempted several techniques, such as including this code snippet in the update function; However, it throws an Uncaught TypeError: Cannot set property '0' of undefined error. Game.mouseTimer.args[0] = game.input.mousePointer.x; Game.mouseTimer.args[1] = game.input.mousePointer.y; To go around the error, I tried to manually initialize the Game.mouseTimer.args array before the loop. This did indeed avoid the error; However, it only updated the arguments once. Thanks.
  3. Hi, I'm new to phaser and so this might be a basic question. I did see: but that did not work for me. This code works: create: function() { image.events.onInputDown.addOnce(this.backToMenu, this); } backToMenu: function() { //do something } but create:function() { image.events.onInputDown.addOnce(this.backToMenu, {test: 0}); } backToMenu: function() { //do something with this.test } does not work at all. If you need more code, I will show you an example project. Thanks!
  4. So I'm going about reducing the number of lines of code in a game I'm creating and I have several functions that are basically doing the same thing: adding a group to my game and proceeding to do a bunch of the same stuff to that group. So I figured I could just unify those instructions into one function and call it a bunch of times for the different groups, passing the name of the group as an argument like so: doGroupStuff: function(groupName){ this.groupName = this.add.group(); //do other stuff to this group }, doGroupStuff(firstGroup); doGroupStuff(secondGroup); (etc.) Except that isn't quite working and I'm probably just being ignorant to something very basic I should know. Can anyone help me?
  5. So, here is the thing; I started a project in 2.5d. To do so, I created a shadow under the character that is in fact a platform which follow his x position, and when he collides with it his y speed becomes 0. Problem is, every enemy character in the screen must have his own shadow, right? Otherwise they'd fall to the bottom of the screen. And each enemy character must have his own shadow, to prevent they colliding with each other's shadow and becoming stuck. I managed to create those. no problem. Problem is making them collide with their own shadows. If there were a way to add arguments to collide, I'd just go for (var i = 0; i < fighters.length; i++){game.physics.arcade.collide(fighters.getAt(i), fighters.getAt(i).shadow, fellDown(fighters.getAt(i)), null, this)function fellDown(fighter){fighter.body.gravity.y = 0;}But that doesn't work. I understand you can call it by going for (var i = 0; i < fighters.length; i++){game.physics.arcade.collide(fighters.getAt(i), fighters.getAt(i).shadow, function(){fighters.getAt(i).body.gravity.y = 0;}, null, this)But that would create a new function everytime a character spawned or jumped, and I'm afraid that would eventually start lagging a good ammount.