mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
Add spinny powerups
This commit is contained in:
parent
cb12352f4f
commit
c2811867ff
5 changed files with 31 additions and 5 deletions
|
|
@ -1,8 +1,6 @@
|
||||||
package src;
|
package src;
|
||||||
|
|
||||||
import shaders.DtsMaterial;
|
|
||||||
import shaders.DtsTexture;
|
import shaders.DtsTexture;
|
||||||
import shaders.DtsMaterialSetup;
|
|
||||||
import h3d.shader.AlphaMult;
|
import h3d.shader.AlphaMult;
|
||||||
import sys.io.File;
|
import sys.io.File;
|
||||||
import src.MarbleWorld;
|
import src.MarbleWorld;
|
||||||
|
|
@ -100,6 +98,9 @@ class DtsObject extends GameObject {
|
||||||
var mountPointNodes:Array<Int>;
|
var mountPointNodes:Array<Int>;
|
||||||
var alphaShader:AlphaMult;
|
var alphaShader:AlphaMult;
|
||||||
|
|
||||||
|
var ambientRotate = false;
|
||||||
|
var ambientSpinFactor = -1 / 3 * Math.PI * 2;
|
||||||
|
|
||||||
public function new() {
|
public function new() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
@ -731,6 +732,16 @@ class DtsObject extends GameObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.ambientRotate) {
|
||||||
|
var spinAnimation = new Quat();
|
||||||
|
spinAnimation.initRotateAxis(0, 0, -1, (currentTime + dt) * this.ambientSpinFactor);
|
||||||
|
|
||||||
|
var orientation = this.getRotationQuat();
|
||||||
|
// spinAnimation.multiply(orientation, spinAnimation);
|
||||||
|
|
||||||
|
this.rootObject.setRotationQuat(spinAnimation);
|
||||||
|
}
|
||||||
|
|
||||||
for (i in 0...this.colliders.length) {
|
for (i in 0...this.colliders.length) {
|
||||||
var absTform = this.graphNodes[i].getAbsPos().clone();
|
var absTform = this.graphNodes[i].getAbsPos().clone();
|
||||||
if (this.colliders[i] != null)
|
if (this.colliders[i] != null)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package shapes;
|
||||||
|
|
||||||
import src.DtsObject;
|
import src.DtsObject;
|
||||||
|
|
||||||
class AntiGravity extends DtsObject {
|
class AntiGravity extends PowerUp {
|
||||||
public function new() {
|
public function new() {
|
||||||
super();
|
super();
|
||||||
this.dtsPath = "data/shapes/items/antigravity.dts";
|
this.dtsPath = "data/shapes/items/antigravity.dts";
|
||||||
|
|
|
||||||
15
src/shapes/PowerUp.hx
Normal file
15
src/shapes/PowerUp.hx
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
package shapes;
|
||||||
|
|
||||||
|
import src.DtsObject;
|
||||||
|
|
||||||
|
class PowerUp extends DtsObject {
|
||||||
|
public var lastPickupTime:Float = -1;
|
||||||
|
public var cooldownDuration:Float = 7;
|
||||||
|
public var autoUse:Bool = false;
|
||||||
|
|
||||||
|
public function new() {
|
||||||
|
super();
|
||||||
|
this.isCollideable = false;
|
||||||
|
this.ambientRotate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,7 +2,7 @@ package shapes;
|
||||||
|
|
||||||
import src.DtsObject;
|
import src.DtsObject;
|
||||||
|
|
||||||
class SuperJump extends DtsObject {
|
class SuperJump extends PowerUp {
|
||||||
public function new() {
|
public function new() {
|
||||||
super();
|
super();
|
||||||
this.dtsPath = "data/shapes/items/superjump.dts";
|
this.dtsPath = "data/shapes/items/superjump.dts";
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package shapes;
|
||||||
|
|
||||||
import src.DtsObject;
|
import src.DtsObject;
|
||||||
|
|
||||||
class SuperSpeed extends DtsObject {
|
class SuperSpeed extends PowerUp {
|
||||||
public function new() {
|
public function new() {
|
||||||
super();
|
super();
|
||||||
this.dtsPath = "data/shapes/items/superspeed.dts";
|
this.dtsPath = "data/shapes/items/superspeed.dts";
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue