Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

I just want to create a sprite that is a square that has physics without importing an image.


codevinsky
 Share

Recommended Posts

Using phaser 1.1.4, I want to create a square. This square will be the player. I don't want to have to import an image.

 

I came from flixel, in which I could create a square, give it a color. 

 

Everything I've read seems to indicate that I'll have to import an image for a sprite. Can I just create it programmatically without needed external assets, or must every sprite have an image?

 

 

 

Link to comment
Share on other sites

You can draw in phaser (using for example the graphics object), like so: http://janpeter.net/perma/phaser/cursorLine.html (use the mouse to draw) - but this graphics object (which you draw in, which is displayed like a sprite) does not (as far as I know) have the body property which is used for physics. (I might be wrong though, or there might be away to attach it to a sprite/ a physics body.)

 

(View the source by rightclick "view source".)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...