JavaNerd

Members
  • Content count

    10
  • Joined

  • Last visited

About JavaNerd

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. JavaNerd

    Changing Scene Issue

    It does not get started twice.
  2. JavaNerd

    Changing Scene Issue

    Yes
  3. JavaNerd

    Changing Scene Issue

    Okay, so this is weird. I left my input listeners in my create function, but surrounded it with this if(gameLoaded) { } at the bottom of my create function, I put: gameLoaded = true; This prevented my input listeners from being repeated. But then my console.log went from 4 to 2 times per click. Then after each time of leaving the scene and coming back, it would go up by one. I then removed the gameLoaded check from around my input listeners and then added this code: if(gameLoaded % 2) { this.scene.restart(); } and put it at the top of my create function. and put this at the bottom of my create function: gameLoaded++; with gameLoaded set to 1 initially. Now my game works as intended, but this seems like a bit of a hacky workaround. Is there a better way to accomplish not repeating input listeners and changing scenes back and forth?
  4. JavaNerd

    Changing Scene Issue

    In my game, when I change scenes from the main scene, to another, and then back to the main scene, it starts picking up additional input actions. For example, if I put console.log("") in: this.input.on('pointerup', function () {}, this); it will print 4 times. Any idea on how to fix this or what is going on?
  5. I'm looking for a 2D artist who can create sprites similar to the ones below. PM for more details.
  6. JavaNerd

    Spawn an image when clicking a button

    Once again, thank you!
  7. I keep getting this.add is undefined. // Building button ui1.on('pointerdown', function () { var window = this.add.image(0, 0, 'window').setOrigin(0); window.setScrollFactor(0); window.setDepth(1002); window.x = 20; window.y = 20; }); I'm trying to spawn an image into the game when the user clicks on the button.
  8. JavaNerd

    Reference dynamic sprite

    This example worked. Thank you.
  9. JavaNerd

    Reference dynamic sprite

    Sorry, last time I coded is when I was working with AS2, and I'm picking this up slowly. var sprite = this.add.sprite(pointer.x + cam.scrollX, pointer.y + cam.scrollY, 'small_fence').setInteractive(); sprite.iName = fenceCount; sprite.on('pointerdown', function () { this.destroy(); }) I spawn sprites in and make them interactive. What I'm trying to do is, I want to reference these sprites later. How can I reference a specific sprite? For example in AS2, I used to be able to give them an instance name like "Sprite1." I would then be able to reference it later like: _root.Sprite1 Is there a way to do this with Phaser, so I can manipulate the sprite when I can't use this.
  10. JavaNerd

    Reference dynamic sprite

    When the user clicks on the screen, it spawns in a sprite. I'm trying to reference these sprites later, how can I do that? For example: Sprite1.name = "Example"; Sprite1.destroy(); Sprite2.name = "Example"; Sprite2.destroy();