Skip to content

Commit

Permalink
add dummy cylinder for the spaceship
Browse files Browse the repository at this point in the history
  • Loading branch information
abiyasa committed Oct 9, 2012
1 parent c2ded10 commit 4c0170e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
Expand Up @@ -17,6 +17,7 @@ package net.richardlord.asteroids
import net.richardlord.asteroids.components.StarlingDisplay;
import net.richardlord.asteroids.graphics.AsteroidView;
import net.richardlord.asteroids.graphics.BulletView;
import net.richardlord.asteroids.graphics.DummyCylinder;
import net.richardlord.asteroids.graphics.DummyQuad;
import net.richardlord.asteroids.graphics.DummySphere;
import net.richardlord.asteroids.graphics.SpaceshipView;
Expand Down Expand Up @@ -82,7 +83,7 @@ package net.richardlord.asteroids
break;

case GameState.RENDER_MODE_AWAY3D:
spaceship.add(new Display3D(new DummySphere(10)));
spaceship.add(new Display3D(new DummyCylinder(10)));
break;

case GameState.RENDER_MODE_DISPLAY_LIST:
Expand Down
@@ -0,0 +1,39 @@
package net.richardlord.asteroids.graphics
{
import away3d.containers.ObjectContainer3D;
import away3d.entities.Mesh;
import away3d.materials.ColorMaterial;
import away3d.primitives.CylinderGeometry;
import away3d.primitives.WireframeCylinder;

/**
* Dummy cylinder
* @author Abiyasa
*/
public class DummyCylinder extends ObjectContainer3D
{

public function DummyCylinder(size:int = 0, color:uint = 0xFFFFFF, wireframe:Boolean = true)
{
super();

// default size
if (size <= 0)
{
size = 10;
}

if (wireframe)
{
this.addChild(new WireframeCylinder(0, size * 0.25, size, 16, 2, color));
}
else
{
var material:ColorMaterial = new ColorMaterial(color);
this.addChild(new Mesh(new CylinderGeometry(0, size * 0.25, size, 16, 1), material));
}
}

}

}

0 comments on commit 4c0170e

Please sign in to comment.