Jump to content

[WIP] ASTEROIDS game


Mvarta
 Share

Recommended Posts

Hi! 
This is my first shot at any type of game development. It's a pretty simple game only viable on desktops at the moment.

Asteroids Game

A few issues I'm aware of-

  • Provide control information in-game
  • Browser responsiveness (multi-platform support)
  • Potential controls for mobile devices?
  • Asset loader

I'd appreciate any additional feedback.

Thanks!

Capture.PNG

Link to comment
Share on other sites

I'm not sure if this is what you mean by "browser responsiveness", but the game canvas was too big for my screen, and I had to scroll/zoom out to see the entire game. You can use window.innerWidth and window.innerHeight to set the game's size correctly.

Good job for your first game!

Link to comment
Share on other sites

Glad to help! 

The game works fine now, I also have some suggestions to improve the physics of the game. The first is to add drag to the ship, so that is doesn't just fly forever in one direction if you let go of the keys. In the updateVX and updateVY functions of your asteroids-player.js, try adding:

vx = vx * 0.98

and the same for updateVY. This should slow down the ship if there is no thrust.

 

Also, it seems like the bullet speeds are somewhat based off of how fast the ship is going. This makes the gameplay a little confusing for me (for example, if I'm going really fast one way and I turn around and shoot the other way the bullets are very slow). I think you should make all the bullets the same speed regardless of the ship's speed.

Link to comment
Share on other sites

Nice work writing this from scratch! I assumed it used Phaser or something but looks like you wrote all the input handling, collision detection. I'm curious as I try to learn more JavaScript, are you following a book or course, or just writing the code based on your past JS experience?

Keep up the good work.

  • took me a few seconds to realize I needed to click start a new game, maybe add a button graphic for that?
  • kevdude's drag suggestion would be cool, the ship moved pretty fast at max speed and was hard to slow down
  • the UFOs are challenging! i like how you have to be moving around always so you don't get shot
Link to comment
Share on other sites

Thank you for your feedback!

@kevdude

I will play around with adding drag to the ship instead of floating, sounds like a neat idea.
The bullet physics are challenging. When I first started the game, I tried implementing bullets the way you explain, but if the bullet's movement is independent of the player, the player can actually "outrun" the bullets and get in front of them, which I didn't like at all.

@dr.au
Maybe keyboard control for the menu would be better? Or start off with "new game" highlighted so you get an idea what's happening

The UFOs do the simplest thing I could think of which is take some player information and shoot directly at him. The effect is kind of cool I guess! Thank you.


I knew a bit of JS before starting the game, then just started reading MDN canvas documentation. Following that, I did some more reading on MDN and various other places about game loops. I also have a book about JS patterns which I skimmed through for ideas, though I find that I use the patterns somewhat haphazardly and make things more complicated than they should be.

Here's a list of resources I have been learning bits and pieces from:

MDN Canvas Tutorial - canvas basics

MDN Game Loop Info - game loop general information

Javier Arevalo HTML5 Game Tutorial - nice implementation of JS game loop

JavaScript Patterns - general pattern info

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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