Sign in to follow this  
asc3ndpony

Accessing and changing properties on the Sprite Object

Recommended Posts

Hi Phaser users, I've been using Phaser for about three weeks and have hit my first wall. I'm making a 2d fighting game and while I have basic attacks working, Phaser apparently kills the sprite on collision with an attack. I'm wanting to set a fixed amount of health so that instead of instantly killing the sprite, the game subtracts the health from the sprite. My sprite names are "player" and "player2", and when I went to the Chrome console, I typed in player and noticed that the player object inherits from  Phaser.Sprite. I saw there were already properties in the Phaser.Sprite object that I think would be useful, such as health and damage. I saw in the API they're listed under the Phaser.Component section, but I didn't see any example under the Examples tag that used them. How would I go about using these properties with my "player" and "player2" sprites? Any help you can provide is greatly appreciated.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.