Jump to content

General Insight/Feedback


Recommended Posts

I'm hoping this is the right place to ask, since I am using the Phaser Framework.



I understand programming logic and briefly studied C++ in college. Still kicking myself for not finishing, but that's another topic. For the past week I've been giving myself a crash course in game development using Phaser, and it's great so far! I'm trying to limit questions and do as much as I can on my own, either by researching or using references to see how things are done. This usually works better for me, as I am more of a hands-on learner.


Anyway, I've been having this nagging feeling for the past day or two that I'm writing my code entirely wrong for what my intended end result is going to be. I know I have a long way to go, and I decided that before I go any further, I ask some questions about the way I'm doing things, and some other things that have been confusing me.


1) Here is the entire code I've written so far. I felt like creating a group was the right way to go, even though they won't all be displayed at once. My end goal is a top down scrolling shoot-em-up game. Think Gradius gameplay meets Galaga camera with more enemies, mayhem, and bosses. I guess Beat Hazard could be another example, though it won't quite be THAT intense. Or music oriented.


2) Anchor Points: How do they work? Right now I've set the anchor point to 0, 0. I'd like for the anchor point of the sprite to be the 'nose' of the ship, where the blaster shot will originate from. Granted, these hardpoints will change depending on the weapon being used at the time (rockets, lasers, spray, dual shot, etc etc), but for now I am only working with 1 weapon type: Blaster. I've tried playing with the anchor point settings in my code, but whenever I change it, the sprites load completely off screen.


3) Setting the Polygon for Collision: Currently, I have the enemy polygons being set inside the group, since that is where they are created. I have this thought in the back of my mind that this is wrong though. I feel like I need to create the polygon for each sprite similar to how the player sprite/polygon is set, then call that information when I create the group so it translates to every sprite created.


4) Killing the wrong bullet: In the current 'build' if you want to call it that, when I shoot at the enemy with 2 bullets, when the first bullet hits the SECOND one is destroyed, leaving the first one to continue through the enemy sprite and trigger the collision, causing the score to skyrocket and the hit.wav file to play a lot of times in a row. Same thing happens when the enemy hits me.



Here is the current build of the game before I added the other 3 enemy polygon values. I know the polygons are working since you can hit any of the 10 top drones. I'm just not sure if that's the correct way for my intended end result.



I greatly appreciate any advice available. I'm kinda just sitting here knowing what I want to do next, but I want to get rid of this nagging feeling that I'm writing the code incorrectly for now. And also fix #4 since I have no idea what I missed for that.


Edit: I forgot to add that if you would like to build this yourself, take game.html out of the url and you'll access the directory that contains the assets and sounds and js files.

Link to comment
Share on other sites

got it partially fixed already. whenever my bullets hit they are killed in order now. i had a little typo :)



now im trying to figure out why whenever an enemy blaster hits me, my ship disappears.  though i think i just figured that bit out...


edit: yep. figured it out. had a typo and words swapped. thats what i get for attempting to do work while half asleep.


now to figure out anchoring...

Link to comment
Share on other sites


  • Recently Browsing   0 members

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