Jump to content

Feedback for my first lines of code (Moon Lander game)


Pixelguy
 Share

Recommended Posts

Hey folks!

 

As someone with a very basic skill in JavaScript, I'm trying to make my first little moon lander game to mess around with the framework.

Currently its just a lander with limited fuel flying around. Nothing special.

But I already feel like I could do better code organisation wise...

 

I tried to make the lander and it's emitters (engine particles) a group but I failed doing so. Currently each udate() I have so align all the emitters x/y to the lander sprite. That feels just wrong.

I'd also love to adjust the particle drag/initial particle speed since there is no air resistance in space but failed there. :unsure:

 

 

Any feedback or advice is welcome! :)

 

http://jsbin.com/udIMoLo/1/edit?html,output

 

Edit: Controls are Arrow Keys and Spacebar

Edited by Pixelguy
Link to comment
Share on other sites

Particle emitters are already Phaser.Groups, and as such can't be added to other groups.

Thee only other way you can adjust where the particles are is by setting the emitX/emitY values on the emitter.

This will spawn the particles at a new location without moving the entire group.

It may give you a different visual effect to what you have now, as the group moving moves all children (as they are relative to the parent) but the emit coords changing does not.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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