ptotheaul

Members
  • Content count

    13
  • Joined

  • Last visited

About ptotheaul

  • Rank
    Member

Recent Profile Visitors

493 profile views
  1. destroy and reset a State

    I want to remove all of the sprites and groups from and reset the variable of a State. So I go from the 'Game' state to a 'Gameover' state/screen. When go back to the 'Game' state I want to totally start over. Is there a way to do this?
  2. I'm trying to use a dragon bones plug in (https://github.com/raksa/phaser-dragonbones#need-help) The example is using a single state and to add the character to the game this is used: var sprite = this.dragonBonesPlugin.getArmature("key"); this.world.add(sprite); I'm trying to empliment this in a state system where my game is defined with the game variable passed in: var theGame = function(game){ etc. Adding normal sprites works like this: this.screenshot = this.game.add.sprite(0, 0, 'ss'); But for some reason trying to add the dragon bones animation like this: this.character = this.dragonBonesPlugin.getArmature('key') this.game.add(this.character); is giving me this error 'TypeError: this.game.add is not a function' Does anyone know what the issue could be? I found this forum which sounds like it has kind of the same issue: I've tried some of the solutions mentioned(like adding 'use strict') but nothing has worked. Any clues? Here is a screen shot of the error info. Could it have something to do with the loading?
  3. I know this might be repetitive but does anyone know where I can find a tutorial on how to make(or codebase) a bubble blaster type game in Phaser? I see a lot of Phaser games based on this so I know it must be out there some where. I've seen other JS tutorials but I hoping for a Phaser specific one.
  4. Game Scaling for a fixed frame size

    I've figured out my question. To scale the game and the assets you use: this.scale.scaleMode = Phaser.ScaleManager.USER_SCALE; this.scale.setUserScale(.7, .7, 0, 0); .7 is a percentage of the original games size. You would just need to calculate the percentage needed to get to 853 x 480.
  5. Game Scaling for a fixed frame size

    I have this exact same question. I have a game that is 1140x710 but I want to scale it down to be 803x500. I've tried: this.scale.setGameSize(803, 500); but this just scales down the container without scaling down any of the assets to the visuals of the game get cut off. How to scale the whole game down proportionally?
  6. setCircle not showing as circle

    I'm using arcade physics to try and set a circle collision. I'm using: game.physics.enable(item, Phaser.Physics.ARCADE); item.body.setCircle(100); but the collision is still based on a rectangle that I can see when debugging. If i change the value in setCircle the size of the rectangle changes but it's still a rectangle. Is there something else I need to do to activate the circle?
  7. Circular Collision

    First of all I'm not sure this is the best way to group element for collision detection but I'm crating CHARACTER elements that contain various sprites that I want to act as one element. I want the different circles(made up of a few sprites) to bounce off of each other. In order to keep all the elements together and since I can't set 'body.setCircle' on a group I'm using the 'circle' sprite for physics and just updating the positions of the other elements to match the x/y of the 'circle' in the bubble.update = function(){}. Is there a better way to do this? My other question is, as I add more CHARACTER's I'd like to add the corresponding 'bubble' sprite to a: game.physics.arcade.collide() so that the 'bubble's bounce off each other. ie game.physics.arcade.collide(bubble1, bubble2, etc) is there a way to do this? CHARACTER _ctor: function() { var character_g = this.game.add.group(); var s1 = imageLoader.sprite(0, 0, 'Idle.png'); var s2 = imageLoader.sprite(0, 0, 'state1.png'); s2.visible = false; var bubble= imageLoader.sprite(0, 0, circle.png'); game.physics.arcade.enable([bubble]); bubble.body.setCircle(160); bubble.body.collideWorldBounds = true; bubble.body.bounce.set(1); bubble.body.gravity.y = 0; bubble.body.velocity.set(150); character_g.add(s1); character_g.add(s2); character_g.add(over); bubble.update = function(){ s1 .x = bubble.x; s1 .y = bubble.y; s2 .x = bubble.x; s2 .y = bubble.y; } s1.inputEnabled=true; s1.events.onInputDown.add(this.itemClick,this); }
  8. I'm creating a group that has a few different image sprites and animations in that group. I use one sprite in the group for the click sprite. What I need to know is how to target the other sprites in the group from the click function. ie: in the below code in 'itemClick' i'd like to set s1 invisible and set s2 visible item_ctor: function() { var item_g = this.game.add.group(); var s1= imageLoader.sprite(0, 0, 'Idle.png'); var s2= imageLoader.sprite(0, 0, 'state1.png'); s2.visible = false; var over= imageLoader.sprite(0, 0, 'hamster/Bubbles/over.png'); item_g.add(s1); item_g.add(s2); item_g.add(over); s1.inputEnabled=true; s1.events.onInputDown.add(this.itemClick,this); }, itemClick: function (sprite, pointer) { console.log("click"); sprite.visible = false; -> THIS WORKS HOW WOULD I TARGET s2 FROM HERE? },
  9. Psudo 3D(2.5D?) Projectile motion

    I'm trying to simulate a ball coming at the screen with a projectile motion arc in 2d space. Does anyone know where there is a tutorial or equations to deal with this. I would image the equation would need to take in the vertical and horizontal angles of the projectile as well as it' initial velocity and the desired start and end scale of the projectile. Any ideas?
  10. Group scale?

    I have a problem. I can scale a group but the bounding rectangles of the groups children do not scale proportional to the group scale. Is there an easy way to do this? I've seen people post that they loop through and reset the body dimensions for the children but it seems like there should be an easier way.
  11. Group scale & body scale

    I wanted to reopen this issue because I'm creating a 2.5D game and having the same issue. Is looping through and resetting the body size really the best option?
  12. I'm trying to develop a canvas game that uses this technique. The game is going to be set to play in landscape mode so I want to the background to be wider then the gameplay area. Since elements come in from off screen I want to make the canvas wider too but also center it so no matter how wide the screen the game still appears to be full screen. Any ideas of the best way to do this?