Upcoming Events
Unite 2010
11/10 - 11/12 @ Montréal, Canada

GDC China
12/5 - 12/7 @ Shanghai, China

Asia Game Show 2010
12/24 - 12/27  

GDC 2011
2/28 - 3/4 @ San Francisco, CA

More events...
Quick Stats
52 people currently visiting GDNet.
2406 articles in the reference section.

Help us fight cancer!
Join SETI Team GDNet!
Link to us Events 4 Gamers
Home » Features » GD Showcase » View Submission
Intel sponsors gamedev.net search:
Game Development Showcase
Track this GDS Entry
Enemy Asteroids
Developer   EnemyBoss
GenreArcade
PlatformWindows
Downloads448

About: Atari's Asteroids was the most popular arcade game in the 80's, before pac-man fever hit the world. Clear the asteroid field by destroying all asteroids with your missiles. Some asteroids will break into fragments. Piloting the ship is challenging, as you will need to strategically use thrusters and steering capabilty, while anticipating inertia in space. Click here to play.

Game Info How To Play Downloads Comments


Description

From Asteroids.java:


/*
______________________________________________________________________________
/ __________________________ o o o o o _______________________ \
| / \_______________________/ \ |
| | ;j: | |
| | D L: | |
| | , L. | |
| | .jLGGGLLLfjt;,: _:f Wj . | |
| | ,tG ______________ E. jf | |
| | , < ____ / K, t G | |
| | f / / /___/ GjjG G | |
| | iGW / /___ _______ f_____ ______________ __ ___| |
|'| :f / ____/ < ___ \ / __ \ < __ __ \ < \ / /|'|
| | ;D / / ____ / / / / / /_/__/ / / / / / / \ / / | |
|'| iE / /____/ / / / / / / /___ / / / / / / \ / |'|
| |DDLjijK <_____________/ <___> /___> \______> <___> <___> <___> / / | |
|'| : _____________ K: :;jt / / |'|
| | ; < ____ \ KW Wf. <___> | |
|'| L / / / / Wf. |'|
| | .W / /___/ / ___Gi__ ______ ______ | |
|'| ; / ____ < / ___ \ / ___> / ___> |'|
| | j WW / / / / / / / / \ < \ < | |
| | f#K; :j / /___/ / / /__/ / ___> \ ___> \ | |
| | jW. ,E <_____________/ \ ______/ <______/ <______/ | |
| | ,, G GttfLGDKKW Ef, | |
| | iK t ...... Copyright (c) 2005 Mujtaba Hasni | |
| | jW D | |
| | iDj http://enemyboss.net | |
| | : enemyboss@gmail.com | |
| | | |
| | Presents: ________________________________ | |
| \_____________________/ E N E M Y A S T E R O I D S \___________________/ |
| | | |
| | ___ .------. | |
| | ____ / \ .-' \ | |
| | / \ ^ / | / \ | |
| | \ \ \ ; / | | |
| | __ \.-._/ '-^-' | | | |
|'| _/ \__ \ / |'|
| | .-' '\ /\ \ / | |
|'| | \ //\\ \ __/ |'|
| | |_ | / \/ \ '-.____/ | |
|'| \ | /______\ |'|
| | \. _/ /.''''''.\ | |
|'| \_.--' |'|
| | _______________________________________________ | |
|'| / "The knack of flying is to throw yourself at | |'|
| | | the ground and miss." | | |
| | | ; | |
| | | -- Hitchhikers Guide To The Galaxy / | |
| | |_____________________________________________/ | |
| | | |
| | _____________________________________ | |
| \__________________/ D I S T R I B U T E D U N D E R \_________________/ |
| | | |
| |--[ The MIT License ] | |
| | | |
| | Copyright (c) 2005 Mujtaba Hasni www.enemyboss.net | |
| | | |
| | Permission is hereby granted, free of charge, to any person obtaining a | |
| | copy of this software and associated documentation files (the | |
|'| "Software") to deal in the Software without restriction, including |'|
| | without limitation the rights to use, copy, modify, merge, publish, | |
|'| distribute, sublicense, and/or sell copies of the Software, and to |'|
| | permit persons to whom the Software is furnished to do so, subject to | |
|'| the following conditions: |'|
| | | |
|'| The above copyright notice and this permission notice shall be included |'|
| | in all copies or substantial portions of the Software. | |
|'| |'|
| | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
| | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
| | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
| | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | |
| | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | |
| | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | |
| | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| | | |
| | * * * | |
| | __________________________________ | |
| \_____________________/ R e v i s i o n H i s t o r y \_________________/ |
| | | |
|'| * Version 1.0a / Jun. 02 2005 / Alpha Release. |'|
| | | |
|'| _________________________ |'|
| \_________________________/ D e s c r i p t i o n \______________________/ |
| | | |
| |--[ Introduction ] | |
| | | |
| | Atari's Asteroids was the most popular arcade game in the 80's, before | |
| | pac-man fever hit the world. Clear the asteroid field by destroying all | |
| | asteroids with your missiles. Some asteroids will break into fragments. | |
| | Piloting the ship is challenging, as you will need to strategically use | |
| | thrusters and steering capabilty, while anticipating inertia in space. | |
| | | |
|'| The original asteroids game use hardware that could draw vector graphics |'|
| | ( lines, polygons, etc ). This game uses Java's Polygon and Graphics2D | |
|'| class to render Vector graphics also. The game also recycles much of the |'|
| | standard Java class library such that no new classes were needed. | |
|'| |'|
| |--[ Instructions ] | |
|'| |'|
| | 1. Press [up] to start the game from the title screen. | |
|'| 2. Press [up] to activate thrusters. |'|
| | 3. Press [left] or [right] to turn ship direction left or right. | |
| | 4. Press [spacebar] to fire missiles ( up to 3 at a time ). | |
| | | |
| | All objects, including the ship, asteroids and missiles "wrap around" | |
| | space. So when an object leaves from the top of the screen, it reappears | |
| | from the bottom. | |
| | | |
| |--[ Levels, Scoring & Extra Lives ] | |
| | | |
|'| The player earns points by destroying asteroids in the asteroid field. |'|
| | Big asteroids are worth 30 points, and small asteroids are 10 points. | |
|'| The game tracks the current score, and last highest score. |'|
| | | |
|'| When the player destroys all asteroids in field, the player goes to |'|
| | the next level. As the player gains more levels, the maximum number | |
|'| of possible asteroids in a field increases. |'|
| | | |
|'| The player earns an extra life every 1000 points earned. The number of |'|
| | lives are indicated in the top-left of the screen. | |
| | | |
| | ________________________________________ | |
| \________________/ B u i l d & I n s t a l l a t i o n \________________/ |
| | | |
| | (+) required, (-) optional | |
| | | |
| |--[ Build Requirements ] | |
| | | |
| | (+) Java2 SE SDK 1.4 or greater. Get it at <http://java.sun.com> | |
| | (+) Asteroids.java - This Java source file. | |
| | | |
| |--[ Data Files ] | |
| | | |
| | (-) explode.wav - Explosion sound sample. | |
| | (-) missile.wav - Missile sound sample. | |
|'| (-) rocket.wav - Rocket engine sound sampl |'|
| | (-) music.mid - Background music sequence | |
| | | |
|'| |'|
| |--[ Building with Java2 SDK ] | |
|'| |'|
| | 1. Build: javac Asteroids.java | |
|'| |'|
| | 2. Run: appletviewer Asteroids.javac. | |
|'| |'|
| | | |
| |--[ Installation & Embedding in a Web document ] | |
| | | |
| | 1. Upload Asteroids.class, *.wav *.mid files to a directory. | |
| | | |
| | 2. Insert the following tags inside an HTML document. | |
| | | |
| | <applet code="Asteroids.class" width="640" height="480"> </applet> | |
| | | |
| | _______________________ | |
| \________________________/ G a m e D e s i g n \_________________________/ |
| | | |
| |--[ Title Screen ] | |
| | | |
| | The title screen is kinda neat I must admit. When I played the arcade | |
| | version on MAME <http://mame.net> I noticed that the ship looked like | |
| | the letter A. So when the title fades in, the ship represents the first | |
| | letter in "Asteroids". | |
| | | |
| |--[ Asteroids ] | |
|'| |'|
| | The asteroids shapes are randomly generated. This is easily done by | |
|'| rotating each of the vertices about the center equally, and extending |'|
| | each vertex by a random distance from the centre. | |
|'| |'|
| | When an asteroid shape is generated, its initialized with a random | |
|'| velocity and is added to the asteroid field. An asteroid is added |'|
| | whenever a large asteroid is broken, or when the asteroid field is | |
|'| cleared and needs to be setup again. |'|
| | | |
| |--[ Star Field ] | |
| | | |
| | The star field is a simple animated background for the game. The stars | |
| | are created as Line2D shapes randomly placed. We rotate odd and even | |
| | numbered stars at different speeds, to give a parallax effect. Half | |
| | the stars rotate 2x faster than the other half. | |
| | | |
| |--[ The Ship ] | |
| | | |
| | The player controls the ship in deep space. Whenever the thrust button | |
| | is pressed, the ship's new velocity is calculated: | |
|'| |'|
| | if ( thrust ) | |
|'| { |'|
| | shipVelocity.x += SHIP_THRUST_SPEED * Math.cos( shipDirection ); | |
|'| shipVelocity.y += SHIP_THRUST_SPEED * Math.sin( shipDirection ); |'|
| | } | |
|'| |'|
| | The ship is modelled out of 3 polygons: The body, cockpit and thruster | |
|'| exhaust. Whenever we rotate or move the ship, we apply this to all parts |'|
| | of the ship, so they move as one object. | |
| | | |
| | When a ship hits an asteroid, it loses a life and becomes invicible for | |
| | one second, allowing the player to get to safety. We use a fade effect | |
| | to show the ship reconstituting itself. Of course when all lives are | |
| | spent, the game is over. | |
| | | |
| |--[ Missiles ] | |
| | | |
| | The ship can fire 3 missiles ( MAX_MISSILES ) at a time. The missiles | |
| | will self destruct after a while, if it doesn't sooner hit an Asteroid. | |
| | When a ship destructs, it explodes but does not make a sound. Only when | |
| | an asteroid is hit does it make an impact sound. The ship can't be | |
| | destroyed by its own missiles. | |
| | | |
| |--[ Explosions ] | |
|'| |'|
| | The explosions are actually quite simple. To explode a shape, we create | |
|'| small triangles (debris) from each segment of the shape and its centre. |'|
| | Each triangle is given a random velocity, colour and life time. As the | |
|'| life time expires, the color fades to black. |'|
| | | |
|'| When updating (moving) the debris, we also rotate even and odd artifacts |'|
| | clockwise and ant-clockwise respectively. | |
|'| |'|
| |--[ Sounds and Music ] | |
| | | |
| | The thruster sound was simply me blowing into the microphone. I then | |
| | used Audacity to cut out the part I want and tweaked the pitch and | |
| | boosted the bass. To make the sound loop, I duplicated the segment into | |
| | another channel, and reversed it. The addition of the two channels makes | |
| | a seamless sound loop. The rest came from flashkit.com. | |
| | | |
|'| The music I chose is a rare Waltz piece with a bent. Few will recognise |'|
| | this from the original SNES game Starfox. The only way you would know | |
|'| this song is if you found the "lost universe" hidden level, by crashing |'|
| | into a certain asteroid. Feel free to twirl your ship around and let | |
|'| the music take you :-P. |'|
| | | |
|'| The midi was sequenced by Master-G, who also makes other midi sequences |'|
| | from Starfox from other games at mastergzoola.tk. | |
|'| |'|
| | _____________ | |
| \_______________________________/ N o t e s \____________________________/ |
| | | |
| | | |
| |--[ Hyper Space ] | |
| | | |
| | There is no hyper-space button. In the original arcade version, you | |
| | could jump to hyper space in a tight situation and appear on a random | |
| | location on the screen. Of course there is no garuntee that where you | |
| | jump too will be any safer. I never liked this idea, so I left it as an | |
| | exercise for those using this code to learn. | |
| | | |
| | | |
| |--[ High Scores Table ] | |
| | | |
|'| Asteroids was the first game to use a high score table, where you can |'|
| | enter your initals ( I use MUJ or EYB ). I was going to impelement a | |
|'| high scores table too. But because this game is in the form of a Java |'|
| | applet, I decided that unless I implement an on-line high-scores table, | |
|'| there is little use in implementing one because it would just reset the |'|
| | next time you play. | |
|'| |'|
| | If I were to implement an online high-scores table, I would use Java's | |
|'| JDBC API to securely connect to an online SQL database, where the |'|
| | high scores table is kept. This also requires a JDBC driver, which you | |
| | would have to get from the database vendor. | |
| | | |
| |--[ Like Any Okay Design... ] | |
| | | |
| | When I began this project, I originally attempted to make the game look | |
| | like the arcade classic, with non-filled polygons and fixed set of | |
| | asteroid shapes. The final result is not at all I was planning on the | |
| | outset, but I think its okay. | |
| | | |
| | Enjoy, | |
| | | |
| | - mujtaba | |
| | _______________________ | |
| \__________________________/ o o o o o \_______________________/ |
\______________________________________________________________________________/

*/





System Requirements

Java2 plug-in or Java2 SE SDK 1.4 or greater.


Screenshots

 
Info
 GDS News
 About the GDS


Genre
 All
 Action
 Adventure
 Arcade
 Educational
 Fighting
 Puzzle
 Racing
 Role-Playing
 Shooter
 Simulation
 Sports
 Strategy
 Traditional


Platform
 DOS
 Linux
 OSX
 Windows