forked from richardlord/Ash
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add dummy cylinder for the spaceship
- Loading branch information
Showing
2 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
examples/no-dependencies/asteroids/net/richardlord/asteroids/graphics/DummyCylinder.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)); | ||
} | ||
} | ||
|
||
} | ||
|
||
} |