Jump to content

Search the Community

Showing results for tags 'scope'.

  • 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 Standards
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
  • 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 14 results

  1. Currently I have a group of sprites and I want to make them all fall at the same time. I am trying to accomplish this with the following functions, where the group (here: fallGroup) should fall when the down arrow key is pressed. (and yes, I have already initialized keys in the create() method) I have tried passing multiple versions of the function definition to callAll() (eg. "this.setVel", "game.setVel", ect.) as well as several different contexts instead of 'null' ("this", "that=this, then passing 'that' in", "game", "game.stage", ect.) but so far nothing happens. For some of the
  2. In the game "Monster Wants Candy," I see this in the source code, and I was wondering why this was done. I've tried doing this myself but keep failing. This is what I mean: var Candy = {}; Candy.Boot = function(game){}; Candy.Boot.prototype = { preload: function(){ // preload the loading indicator first before anything else this.load.image('preloaderBar', 'img/loading-bar.png'); }, create: function(){ // set scale options this.input.maxPointers = 1; this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; this.scale.pageAlignHorizontally = true; this.scale.pageAlignVertical
  3. So I'm currently following @rich 's Shoot-em-up tutorial from over here https://phaser.io/tutorials/coding-tips-007. Please have a look at the source code if you haven't already. From what I understand he create's a weapon array that holds all the weapon types (each of which are an object inside a Weapon object). Now my question is How do I access the current weapon bullets in game.physics.arcade.collide? I've used game.physics.arcade.collide(this.weapon[this.currentWeapon], this.enemies) and this works fine, the bullets and the enemy collide well. BUT what if I wan
  4. Hi guys may I ask a quick question? I'm working with Phaser and I'm using the module pattern, creating a module that has a prototype of Object.create(Phaser.Sprite.prototype) and creating an instance of that in the main module. The problem is the sprite seems to be created in the main module in the create function but the image of the sprite is not loading and i cant find the problem or set the image. Thanks so much!!
  5. I am having difficulty understanding this and scope in Javascript. I am attempting to create a dialogue box that pops up during various collisions, and perhaps part of the issue is I am not properly organizing my game. I can use this.showPopup("jump"); in the update function, but I cannot figure out how to call the showPopup function elsewhere, in getItem. I keep getting the error, "Uncaught TypeError: this.showPopup is not a function(…)" Any help is greatly appreciated. create: function() { ... popup = game.add.sprite(window.innerWidth/2, 200, 'box'); ... }, update:function (){
  6. Hey everyone I am building a game on top of the babylon engine and I keep all babylon objects inside the meta "game object". I am having trouble with the scope of the variables when performing event related animations, sometimes it works sometimes it does not... And I have not idea why. I was playing around with the sky material tutorial http://www.babylonjs-playground.com/#E6OZX#6, that has some key binding to control the daylight. var setSkyConfig = function(property, from, to) { var keys = [{ frame: 0, value: from }, { frame:
  7. Hi people, I've recently just started using the Phaser framework 2 days ago and I am developing my first game, an RPG with phaser...I recently just ran into an issue in my character select state where my scope(this) becomes the window scope and does not recognize my internal functions. Any insight on my issue would be extremely helpful. thank you!!!
  8. Hello everyone, I just started Phaser, and I am trying to get a sprite to change on button click: create: function() { this.game.button = this.game.add.button(this.game.world.centerX-450, 660, 'button', this.nextPage(this.currentLevel, 0), this, 2, 1, 0); this.game.button.anchor.setTo(0.5); this.game.button.input.useHandCursor = true; this.game.button.input.priorityID = 0; this.game.sprite2 = this.game.add.sprite(this.game.world.centerX-475, this.game.world.centerY-20, 'button-comb'); this.game.sprite2.anchor.setTo(0.5); } Here is the nextPage code: nextPage: func
  9. Hello ! I really want to read the source code of phaser, but I am not that professional. the namespace Phaser is declared inside a function, so I am wondering how we can access it outside it ? (function(){ var Phaser = Phaser || {}; }).call(this); Phaser.something = 5; //Reference error, Phaser is not declared what things I ca learn to read the source code perfectly and have this awesome experience ?
  10. Hello, I am working on implementing drag and drop in my scene. I have a sphere being created successfully. But when I click on it (mouse down), I do not get the expected drag behavior. I am basically working from the example and I can even reproduce the example in an "in situ" text fixture (i.e. Visual Studio hosted standalone HTML page). Both work equally well. Next, I want to connect the drag and drop stuff with a jQuery "scene:created" trigger. This is potentially where things fall over. I do not get the pointer down event, for starters, that I think I should be getting.
  11. Hey there, I'm new to javascript and I'm trying to figure out how to create a global singleton for generic functions. I can create global variables in the Boot state, but I'd like to create an object that holds global vars and functions. I'm instancing a custom GameManager script in the index.html file like so: //initialize framework var game = new Phaser.Game(640, 960, Phaser.AUTO, 'game'); //create global object var gameManager = new GameManager(); My GameManager.js file looks like this: var GameManager = function GameManager() { console.lo
  12. Hi guys, I am a new member to this community and entirely new to HTML5 game development. I came across Pandajs on my search for a viable 2D game engine with which I can pick up and excel my skills in HTML5 game development. Thanks to enpu for making this game engine! The below links and examples from github helped me to overcome issues during my initial stages of development. Like adding Sprite, Animations and Containers and also creating Modules and Classes. Even though I was able to achieve these, there are these couple of concepts which I am still unclear of and need help from someone t
  13. Anther WTF moment with Typescript. It is similar to a previous problem I had, but doesn't have the same solution. Could someone explain this, please? module TestGame{export class StateSettingStage extends Phaser.State { sally: TargetSprite; //subclass of Phaser.Sprite shoes: Token; //subclass of Phaser.Sprite this.sally = new TargetSprite(this.game, 350, 20, "sally"); this.game.add.existing(this.sally); this.shoes= new TargetSprite(this.game, 350, 20, "shoes"); this.game.add.existing(this.shoes); ->this.shoes.setTargetSprite(this.sally); <--- No problem this.clothes.children.for
  14. Hi, I'm trying to create a small javascript app which loads a JSON url and displays some html and divs based on the JSON data. It's got to be as small as possible so without using a frameworks like Phaser and jQuery. The javascript scope of variables is a bit tricky, and I'm having some trouble getting it to work properly. My question is, how can create the MyGame class with an imageShapes image and then reference that imageShapes in the onreadystatechange method of XMLHttpRequest? Here is my code:// namespacevar MyGame = MyGame || { gamedata: [], test123: 'This is a test value 123'};//
×
×
  • Create New...