Browse Source

Merge branch 'master' of github.com:ncannasse/h3d

Nicolas Cannasse 11 years ago
parent
commit
1b66b10247
3 changed files with 17 additions and 5 deletions
  1. 3 3
      h2d/Anim.hx
  2. 5 0
      h3d/parts/Data.hx
  3. 9 2
      h3d/parts/Editor.hx

+ 3 - 3
h2d/Anim.hx

@@ -7,11 +7,11 @@ class Anim extends Drawable {
 	public var speed : Float;
 	public var loop : Bool = true;
 	
-	public function new( ?parent ) {
+	public function new( ?frames, ?speed, ?parent ) {
 		super(parent);
-		this.frames = [];
+		this.frames = frames == null ? [] : frames;
 		this.currentFrame = 0;
-		this.speed = 1.;
+		this.speed = speed == null ? 15 : speed;
 	}
 	
 	public function play( frames ) {

+ 5 - 0
h3d/parts/Data.hx

@@ -113,6 +113,9 @@ class State {
 	// animation
 	public var frame : Null<Value>;
 	
+	// extra
+	public var delay : Float;
+	
 	public function new() {
 	}
 	
@@ -150,6 +153,8 @@ class State {
 		collide = false;
 		collideKill = false;
 		bounce = 0;
+		// extra
+		delay = 0.;
 	}
 	
 	public /*inline*/ function eval( v : Value, time : Float, rand : Void -> Float ) : Float {

+ 9 - 2
h3d/parts/Editor.hx

@@ -259,6 +259,10 @@ class Editor extends h2d.Sprite {
 						background-color : #555;
 					}
 					
+					span.label {
+						width : 97px;
+					}
+					
 					.buttons {
 						layout : inline;
 					}
@@ -377,9 +381,12 @@ class Editor extends h2d.Sprite {
 					<div class="sep"></div>
 					<div class="col">
 						<div class="line">
-							<span>Life</span> <value value="${state.globalLife}" onchange="api.s.globalLife = this.value"/>
+							<span class="label">Life</span> <value value="${state.globalLife}" onchange="api.s.globalLife = this.value"/>
 							<checkbox checked="${state.loop}" onchange="api.s.loop = this.checked"/> <span>Loop</span>
 						</div>
+						<div class="line">
+							<span class="label">Start Delay</span> <value value="${state.delay}" onchange="api.s.delay = this.value"/>
+						</div>
 						<div class="line">
 							<select onchange="api.s.blendMode = api.blendModes[api.parseInt(this.value)]; $(\'.ic.alpha\').toggleClass(\':disabled\', api.s.blendMode.index == 2)">
 								<option value="0" selected="${state.blendMode == Add}">Additive</option>
@@ -407,7 +414,7 @@ class Editor extends h2d.Sprite {
 							<span>Max</span> <value value="${state.maxParts}" increment="1" onchange="api.s.maxParts = this.value"/>
 						</div>
 						<div class="line">
-							<span>Emitter Type</span> <select onchange="api.setCurShape(api.parseInt(this.value))">
+							<span class="label">Emitter Type</span> <select onchange="api.setCurShape(api.parseInt(this.value))">
 								<option value="0" selected="${state.shape.match(SLine(_))}">Line</option>
 								<option value="1" selected="${state.shape.match(SSphere(_))}">Sphere</option>
 								<option value="2" selected="${state.shape.match(SCone(_))}">Cone</option>