Add game source, converter pipeline, and web port

This commit is contained in:
2026-08-12 18:59:06 +02:00
parent 3e6635eac6
commit bd13ad67cc
97 changed files with 8781 additions and 0 deletions
@@ -0,0 +1,7 @@
/*
* Decompiled with CFR 0.152.
*/
package mygame;
interface AnimeEventListener {
}
+31
View File
@@ -0,0 +1,31 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.jme3.animation.AnimChannel
* com.jme3.animation.AnimControl
* com.jme3.scene.Spatial
*/
package mygame;
import com.jme3.animation.AnimChannel;
import com.jme3.animation.AnimControl;
import com.jme3.scene.Spatial;
import mygame.Interactive;
public abstract class Character
extends Interactive {
public AnimChannel modelAnimChannel;
public AnimControl modelAnimControl;
public Character(String name) {
super(name);
}
public void setModel(Spatial model) {
super.setModel(model);
this.setupModelControl();
}
public abstract void setupModelControl();
}
+106
View File
@@ -0,0 +1,106 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.jme3.animation.AnimControl
* com.jme3.bullet.collision.shapes.CapsuleCollisionShape
* com.jme3.bullet.collision.shapes.CollisionShape
* com.jme3.bullet.control.GhostControl
* com.jme3.effect.ParticleEmitter
* com.jme3.effect.ParticleMesh$Type
* com.jme3.light.Light
* com.jme3.light.PointLight
* com.jme3.material.Material
* com.jme3.math.ColorRGBA
* com.jme3.math.Vector3f
* com.jme3.scene.Spatial
* com.jme3.scene.control.Control
*/
package mygame;
import com.jme3.animation.AnimControl;
import com.jme3.bullet.collision.shapes.CapsuleCollisionShape;
import com.jme3.bullet.collision.shapes.CollisionShape;
import com.jme3.bullet.control.GhostControl;
import com.jme3.effect.ParticleEmitter;
import com.jme3.effect.ParticleMesh;
import com.jme3.light.Light;
import com.jme3.light.PointLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Spatial;
import com.jme3.scene.control.Control;
import mygame.Character;
import mygame.CrossControl;
import mygame.Exchange;
public class Cross
extends Character {
public GhostControl collision;
public CrossControl control;
private PointLight light;
public Cross(String name) {
super(name);
this.setModel();
this.setupControl();
}
public void setupModelControl() {
this.modelAnimControl = (AnimControl)this.model.getControl(AnimControl.class);
this.modelAnimChannel = this.modelAnimControl.createChannel();
this.modelAnimChannel.setAnim("normal");
this.modelAnimChannel.setSpeed(0.5f);
}
void setupModel() {
this.wholeBody.attachChild(this.model);
}
public void setupControl() {
this.collision = new GhostControl((CollisionShape)new CapsuleCollisionShape(1.0f, 0.5f));
this.collision.addCollideWithGroup(2);
this.addControl((Control)this.collision);
this.control = new CrossControl();
this.addControl((Control)this.control);
Exchange.bulletAppState.getPhysicsSpace().add((Object)this.collision);
}
public void setModel() {
this.model = Exchange.assetManager.loadModel("Models/kross/kross.mesh.j3o");
this.setLocalScale(0.25f);
this.setupModel();
this.setupModelControl();
this.wholeBody.attachChild(this.model);
ParticleEmitter funken = new ParticleEmitter("Emitter", ParticleMesh.Type.Triangle, 50);
Material mat_red = new Material(Exchange.assetManager, "Common/MatDefs/Misc/Particle.j3md");
mat_red.setTexture("Texture", Exchange.assetManager.loadTexture("Effects/flame.png"));
funken.setMaterial(mat_red);
funken.setImagesX(2);
funken.setImagesY(2);
funken.setEndColor(new ColorRGBA(0.0f, 1.0f, 0.0f, 1.0f));
funken.setStartColor(new ColorRGBA(0.0f, 1.0f, 0.0f, 1.0f));
funken.getParticleInfluencer().setInitialVelocity(new Vector3f(0.25f, 2.0f, 0.25f));
funken.setStartSize(0.1f);
funken.setEndSize(0.1f);
funken.setGravity(0.0f, 0.0f, 0.0f);
funken.setLowLife(1.0f);
funken.setHighLife(2.0f);
funken.getParticleInfluencer().setVelocityVariation(1.0f);
this.attachChild((Spatial)funken);
}
public void kill() {
this.removeFromParent();
Exchange.rootNode.removeLight((Light)this.light);
}
public void setLight() {
this.light = new PointLight();
this.light.setPosition(this.getLocalTranslation().add(new Vector3f(0.0f, 1.0f, 0.0f)));
this.light.setColor(ColorRGBA.Green);
this.light.setRadius(10.0f);
Exchange.rootNode.addLight((Light)this.light);
}
}
+31
View File
@@ -0,0 +1,31 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.jme3.renderer.RenderManager
* com.jme3.renderer.ViewPort
* com.jme3.scene.control.AbstractControl
*/
package mygame;
import com.jme3.renderer.RenderManager;
import com.jme3.renderer.ViewPort;
import com.jme3.scene.control.AbstractControl;
import mygame.Cross;
import mygame.Exchange;
import mygame.Player;
public class CrossControl
extends AbstractControl {
protected void controlUpdate(float tpf) {
Cross cross = (Cross)this.spatial;
Player player = (Player)Exchange.rootNode.getChild("Player");
if (cross.collision.getOverlappingObjects().contains(player.collision)) {
player.heal(25.0f);
cross.kill();
}
}
protected void controlRender(RenderManager rm, ViewPort vp) {
}
}
+101
View File
@@ -0,0 +1,101 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.jme3.app.SimpleApplication
* com.jme3.asset.AssetManager
* com.jme3.bullet.BulletAppState
* com.jme3.math.Vector3f
* com.jme3.renderer.ViewPort
* com.jme3.scene.Node
* com.jme3.scene.Spatial
*/
package mygame;
import com.jme3.app.SimpleApplication;
import com.jme3.asset.AssetManager;
import com.jme3.bullet.BulletAppState;
import com.jme3.math.Vector3f;
import com.jme3.renderer.ViewPort;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import java.util.ArrayList;
import java.util.Random;
import mygame.Cross;
import mygame.WalkingEnemy;
public class Exchange {
public static ArrayList<WalkingEnemy> enemies;
public static Node rootNode;
public static BulletAppState bulletAppState;
public static AssetManager assetManager;
public static ViewPort viewPort;
public static SimpleApplication app;
public static int killed;
public static int getKilled() {
return killed;
}
public static void setKilled(int killed) {
Exchange.killed = killed;
}
public static SimpleApplication getApp() {
return app;
}
public static void setApp(SimpleApplication app) {
Exchange.app = app;
}
public static AssetManager getAssetManager() {
return assetManager;
}
public static void setAssetManager(AssetManager assetManager) {
Exchange.assetManager = assetManager;
}
public static BulletAppState getBulletAppState() {
return bulletAppState;
}
public static void setBulletAppState(BulletAppState bulletAppState) {
Exchange.bulletAppState = bulletAppState;
}
public static Node getRootNode() {
return rootNode;
}
public static void setRootNode(Node rootNode) {
Exchange.rootNode = rootNode;
}
public Exchange() {
enemies = new ArrayList();
}
public static void removeEnemy(WalkingEnemy en) {
enemies.remove((Object)en);
}
public static ViewPort getViewPort() {
return viewPort;
}
public static void setViewPort(ViewPort viewPort) {
Exchange.viewPort = viewPort;
}
public static void spawnItem(Vector3f place) {
Random r = new Random();
if (r.nextInt(100) > 90) {
Cross cross = new Cross("Cross");
cross.setLocalTranslation(place);
cross.setLight();
rootNode.attachChild((Spatial)cross);
}
}
}
+181
View File
@@ -0,0 +1,181 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.jme3.asset.AssetManager
* com.jme3.audio.AudioNode
* com.jme3.bullet.collision.shapes.CapsuleCollisionShape
* com.jme3.bullet.collision.shapes.CollisionShape
* com.jme3.bullet.control.BetterCharacterControl
* com.jme3.bullet.control.GhostControl
* com.jme3.effect.ParticleEmitter
* com.jme3.effect.ParticleMesh$Type
* com.jme3.light.Light
* com.jme3.light.PointLight
* com.jme3.material.Material
* com.jme3.math.ColorRGBA
* com.jme3.math.Vector3f
* com.jme3.post.SceneProcessor
* com.jme3.scene.Node
* com.jme3.scene.Spatial
* com.jme3.scene.control.Control
* com.jme3.scene.control.LightControl
* com.jme3.shadow.EdgeFilteringMode
* com.jme3.shadow.PointLightShadowFilter
* com.jme3.shadow.PointLightShadowRenderer
*/
package mygame;
import com.jme3.asset.AssetManager;
import com.jme3.audio.AudioNode;
import com.jme3.bullet.collision.shapes.CapsuleCollisionShape;
import com.jme3.bullet.collision.shapes.CollisionShape;
import com.jme3.bullet.control.BetterCharacterControl;
import com.jme3.bullet.control.GhostControl;
import com.jme3.effect.ParticleEmitter;
import com.jme3.effect.ParticleMesh;
import com.jme3.light.Light;
import com.jme3.light.PointLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.post.SceneProcessor;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.jme3.scene.control.Control;
import com.jme3.scene.control.LightControl;
import com.jme3.shadow.EdgeFilteringMode;
import com.jme3.shadow.PointLightShadowFilter;
import com.jme3.shadow.PointLightShadowRenderer;
import mygame.Exchange;
import mygame.FireballControl;
public class Fireball
extends Node {
ParticleEmitter fire;
PointLight light;
LightControl lightControl;
GhostControl collisionGhost;
GhostControl damageAreaGhost;
BetterCharacterControl bodyControl;
PointLightShadowRenderer dlsr;
PointLightShadowFilter dlsf;
FireballControl fireballControl;
private AssetManager assetManager;
Vector3f direction;
Exchange exchange;
boolean explode;
float timer;
float lifetime = 1.0f;
public Fireball(AssetManager assetManager, Vector3f finish, Vector3f start, Exchange ex) {
this.direction = finish;
this.exchange = ex;
assetManager = Exchange.assetManager;
this.setLocalTranslation(start.add(new Vector3f(1.0f, 1.0f, 1.0f)));
this.fire = new ParticleEmitter("Emitter", ParticleMesh.Type.Triangle, 30);
Material mat_red = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
mat_red.setTexture("Texture", assetManager.loadTexture("Effects/flame.png"));
this.fire.setMaterial(mat_red);
this.fire.setImagesX(2);
this.fire.setImagesY(2);
this.fire.setEndColor(new ColorRGBA(1.0f, 0.0f, 0.0f, 1.0f));
this.fire.setStartColor(new ColorRGBA(1.0f, 1.0f, 0.0f, 0.5f));
this.fire.getParticleInfluencer().setInitialVelocity(new Vector3f(0.0f, 2.0f, 0.0f));
this.fire.setStartSize(1.5f);
this.fire.setEndSize(0.1f);
this.fire.setGravity(0.0f, 0.0f, 0.0f);
this.fire.setLowLife(1.0f);
this.fire.setHighLife(3.0f);
this.fire.getParticleInfluencer().setVelocityVariation(0.3f);
this.attachChild((Spatial)this.fire);
this.light = new PointLight();
this.light.setColor(new ColorRGBA(1.0f, 0.5f, 0.0f, 1.0f));
this.light.setPosition(this.getLocalTranslation());
this.light.setRadius(100.0f);
Exchange.rootNode.addLight((Light)this.light);
this.dlsr = new PointLightShadowRenderer(assetManager, 128);
this.dlsr.setLight(this.light);
this.dlsr.setShadowIntensity(0.2f);
this.dlsr.setEdgeFilteringMode(EdgeFilteringMode.Dither);
Exchange.viewPort.addProcessor((SceneProcessor)this.dlsr);
this.dlsf = new PointLightShadowFilter(assetManager, 128);
this.dlsf.setLight(this.light);
this.dlsf.setShadowIntensity(0.2f);
this.dlsf.setEdgeFilteringMode(EdgeFilteringMode.Dither);
this.dlsf.setEnabled(false);
this.collisionGhost = new GhostControl((CollisionShape)new CapsuleCollisionShape(1.0f, 0.5f));
this.collisionGhost.setSpatial((Spatial)this);
this.collisionGhost.addCollideWithGroup(1);
this.addControl((Control)this.collisionGhost);
this.damageAreaGhost = new GhostControl((CollisionShape)new CapsuleCollisionShape(5.0f, 1.0f));
this.damageAreaGhost.addCollideWithGroup(1);
this.addControl((Control)this.damageAreaGhost);
this.bodyControl = new BetterCharacterControl(0.1f, 0.1f, 1.0f);
this.addControl((Control)this.bodyControl);
this.fireballControl = new FireballControl();
this.addControl((Control)this.fireballControl);
Exchange.rootNode.attachChild((Spatial)this);
Exchange.bulletAppState.getPhysicsSpace().add((Object)this.damageAreaGhost);
Exchange.bulletAppState.getPhysicsSpace().add((Object)this.collisionGhost);
Exchange.bulletAppState.getPhysicsSpace().add((Object)this.bodyControl);
AudioNode hit = new AudioNode(assetManager, "Sounds/Effects/fireball.ogg", false);
hit.setLooping(false);
hit.setPositional(true);
hit.setLocalTranslation(this.getLocalTranslation());
hit.setVolume(5.0f);
this.attachChild((Spatial)hit);
hit.play();
}
public void explode() {
ParticleEmitter xplosion = new ParticleEmitter("Emitter", ParticleMesh.Type.Triangle, 50);
Material mat_red = new Material(Exchange.assetManager, "Common/MatDefs/Misc/Particle.j3md");
mat_red.setTexture("Texture", Exchange.assetManager.loadTexture("Effects/flame.png"));
xplosion.setMaterial(mat_red);
xplosion.setImagesX(2);
xplosion.setParticlesPerSec(0.0f);
xplosion.setImagesY(2);
xplosion.setEndColor(new ColorRGBA(1.0f, 0.0f, 0.0f, 1.0f));
xplosion.setStartColor(new ColorRGBA(1.0f, 1.0f, 0.0f, 0.5f));
xplosion.getParticleInfluencer().setInitialVelocity(new Vector3f(0.5f, 0.5f, 0.5f));
xplosion.setStartSize(1.5f);
xplosion.setEndSize(2.0f);
xplosion.setGravity(0.0f, 1.0f, 0.0f);
xplosion.setLowLife(1.0f);
xplosion.setHighLife(2.0f);
xplosion.getParticleInfluencer().setVelocityVariation(2.0f);
this.attachChild((Spatial)xplosion);
xplosion.emitAllParticles();
ParticleEmitter stones = new ParticleEmitter("Emitter", ParticleMesh.Type.Triangle, 20);
Material mat_stones = new Material(Exchange.assetManager, "Common/MatDefs/Misc/Particle.j3md");
mat_stones.setTexture("Texture", Exchange.assetManager.loadTexture("Effects/stein.png"));
mat_stones.setTexture("GlowMap", Exchange.assetManager.loadTexture("Effects/stein.png"));
mat_stones.setTexture("DepthTexture", Exchange.assetManager.loadTexture("Effects/stein.png"));
stones.setMaterial(mat_stones);
stones.setImagesX(2);
stones.setParticlesPerSec(0.0f);
stones.setImagesY(2);
stones.setEndColor(new ColorRGBA(0.1f, 0.1f, 0.1f, 1.0f));
stones.setStartColor(new ColorRGBA(0.0f, 0.0f, 0.0f, 1.0f));
stones.getParticleInfluencer().setInitialVelocity(new Vector3f(2.0f, 0.0f, 2.0f));
stones.setStartSize(0.1f);
stones.setEndSize(0.5f);
stones.setGravity(2.0f, 0.0f, 2.0f);
stones.setLowLife(1.0f);
stones.setHighLife(1.0f);
stones.getParticleInfluencer().setVelocityVariation(5.0f);
this.attachChild((Spatial)stones);
stones.emitAllParticles();
AudioNode explode = new AudioNode(Exchange.assetManager, "Sounds/Effects/explosion.ogg", false);
explode.setLooping(false);
explode.setPositional(true);
explode.setLocalTranslation(this.getLocalTranslation());
explode.setVolume(5.0f);
this.attachChild((Spatial)explode);
explode.play();
this.explode = true;
this.fire.emitAllParticles();
this.timer = 0.1f;
}
}
+89
View File
@@ -0,0 +1,89 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.jme3.light.Light
* com.jme3.math.Vector3f
* com.jme3.post.SceneProcessor
* com.jme3.renderer.RenderManager
* com.jme3.renderer.ViewPort
* com.jme3.scene.control.AbstractControl
* com.jme3.scene.control.Control
*/
package mygame;
import com.jme3.light.Light;
import com.jme3.math.Vector3f;
import com.jme3.post.SceneProcessor;
import com.jme3.renderer.RenderManager;
import com.jme3.renderer.ViewPort;
import com.jme3.scene.control.AbstractControl;
import com.jme3.scene.control.Control;
import mygame.Exchange;
import mygame.Fireball;
import mygame.WalkingEnemy;
public class FireballControl
extends AbstractControl {
protected void controlUpdate(float tpf) {
WalkingEnemy enemy;
Fireball fireball = (Fireball)this.spatial;
if (!fireball.explode) {
fireball.bodyControl.setWalkDirection(fireball.direction);
} else {
fireball.bodyControl.setWalkDirection(Vector3f.ZERO);
}
Vector3f lightpos = fireball.collisionGhost.getPhysicsLocation();
lightpos.setY(0.5f);
fireball.light.setPosition(lightpos);
int i = 0;
while (true) {
Exchange cfr_ignored_0 = fireball.exchange;
if (i >= Exchange.enemies.size()) break;
Exchange cfr_ignored_1 = fireball.exchange;
enemy = Exchange.enemies.get(i);
if (fireball.collisionGhost.getOverlappingObjects().contains(enemy.ghost)) {
fireball.explode = true;
}
++i;
}
if (fireball.explode) {
i = 0;
while (true) {
Exchange cfr_ignored_2 = fireball.exchange;
if (i >= Exchange.enemies.size()) break;
Exchange cfr_ignored_3 = fireball.exchange;
enemy = Exchange.enemies.get(i);
if (fireball.damageAreaGhost.getOverlappingObjects().contains(enemy.ghost)) {
enemy.doDamage(100.0f);
fireball.explode();
}
++i;
}
}
fireball.lifetime -= tpf;
if (fireball.lifetime <= 0.0f && !fireball.explode) {
fireball.explode();
}
if (fireball.timer > 0.0f) {
fireball.timer += tpf;
if ((double)fireball.timer > 0.2) {
fireball.bodyControl.setEnabled(false);
fireball.removeControl((Control)fireball.bodyControl);
fireball.removeControl((Control)fireball.collisionGhost);
fireball.collisionGhost.setEnabled(false);
fireball.removeControl((Control)fireball.damageAreaGhost);
fireball.damageAreaGhost.setEnabled(false);
fireball.fire.setEnabled(false);
}
if (fireball.timer > 2.0f) {
fireball.removeFromParent();
Exchange.viewPort.removeProcessor((SceneProcessor)fireball.dlsr);
Exchange.rootNode.removeLight((Light)fireball.light);
}
}
}
protected void controlRender(RenderManager rm, ViewPort vp) {
}
}
+38
View File
@@ -0,0 +1,38 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.jme3.renderer.queue.RenderQueue$ShadowMode
* com.jme3.scene.Node
* com.jme3.scene.Spatial
*/
package mygame;
import com.jme3.renderer.queue.RenderQueue;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
public abstract class Interactive
extends Node {
public Spatial model;
public Node wholeBody;
public Interactive(String name) {
super(name);
this.setShadowMode(RenderQueue.ShadowMode.Cast);
this.wholeBody = new Node(name);
this.attachChild((Spatial)this.wholeBody);
}
public Spatial getModel() {
return this.model;
}
public void setModel(Spatial model) {
this.model = model;
this.setupModel();
this.wholeBody.attachChild(model);
}
abstract void setupModel();
}
+15
View File
@@ -0,0 +1,15 @@
/*
* Decompiled with CFR 0.152.
*/
package mygame;
import jme3.hello.TestCameraNode;
public class Main {
public static void main(String[] args) {
TestCameraNode app = new TestCameraNode();
app.setDisplayFps(false);
app.setDisplayStatView(false);
app.start();
}
}
+150
View File
@@ -0,0 +1,150 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.jme3.animation.AnimChannel
* com.jme3.animation.AnimControl
* com.jme3.animation.LoopMode
* com.jme3.bullet.collision.shapes.CapsuleCollisionShape
* com.jme3.bullet.collision.shapes.CollisionShape
* com.jme3.bullet.control.BetterCharacterControl
* com.jme3.bullet.control.GhostControl
* com.jme3.math.Vector3f
* com.jme3.scene.Spatial
* com.jme3.scene.control.Control
*/
package mygame;
import com.jme3.animation.AnimChannel;
import com.jme3.animation.AnimControl;
import com.jme3.animation.LoopMode;
import com.jme3.bullet.collision.shapes.CapsuleCollisionShape;
import com.jme3.bullet.collision.shapes.CollisionShape;
import com.jme3.bullet.control.BetterCharacterControl;
import com.jme3.bullet.control.GhostControl;
import com.jme3.math.Vector3f;
import com.jme3.scene.Spatial;
import com.jme3.scene.control.Control;
import mygame.Character;
import mygame.Exchange;
import mygame.Weapon;
public class Player
extends Character {
public Weapon rightHand;
public Weapon leftHand;
public Spatial hat;
public Spatial model;
public BetterCharacterControl playerControl;
public AnimChannel leftHandAnimChannel;
public AnimControl leftHandAnimControl;
public AnimChannel rightHandAnimChannel;
public AnimControl rightHandAnimControl;
public Vector3f pt;
public GhostControl collision;
public float health = 100.0f;
public static float MAX_HEALTH = 100.0f;
public Player(String name) {
super(name);
}
public Spatial getRightHand() {
return this.rightHand;
}
public void setRightHand(Weapon rightHand) {
this.rightHand = rightHand;
this.setupRightHand();
}
public Spatial getLeftHand() {
return this.leftHand;
}
public void setLeftHand(Weapon leftHand) {
this.leftHand = leftHand;
this.setupLeftHand();
}
public Spatial getHat() {
return this.hat;
}
public void setHat(Spatial hat) {
this.hat = hat;
this.setupHat();
}
public Spatial getModel() {
return this.model;
}
public void setModel(Spatial model) {
this.model = model;
this.setupModel();
this.setupControl();
this.setupModelControl();
this.wholeBody.attachChild(this.model);
}
public void switchHands() {
this.wholeBody.detachChild((Spatial)this.leftHand);
this.wholeBody.detachChild((Spatial)this.rightHand);
Weapon temp = this.rightHand;
this.setRightHand(this.leftHand);
this.setLeftHand(temp);
}
public void die() {
this.modelAnimChannel.setAnim("die");
this.modelAnimChannel.setLoopMode(LoopMode.DontLoop);
this.wholeBody.setLocalTranslation(0.0f, 0.5f, 0.0f);
this.wholeBody.detachChild(this.hat);
this.wholeBody.detachChild((Spatial)this.rightHand);
this.wholeBody.detachChild((Spatial)this.leftHand);
}
private void setupLeftHand() {
this.leftHand.setLocalTranslation(0.4f, 0.3f, 0.4f);
this.leftHand.setLocalScale(0.35f);
this.wholeBody.attachChild((Spatial)this.leftHand);
}
private void setupRightHand() {
this.rightHand.setLocalTranslation(-0.4f, 0.3f, 0.4f);
this.rightHand.setLocalScale(0.35f);
this.wholeBody.attachChild((Spatial)this.rightHand);
}
private void setupHat() {
this.hat.setLocalScale(0.35f);
this.hat.setLocalTranslation(0.0f, 0.9f, -0.2f);
this.hat.rotate(-0.4f, 0.0f, 0.0f);
this.wholeBody.attachChild(this.hat);
}
public void setupModel() {
this.model.setLocalScale(0.5f);
this.wholeBody.attachChild(this.model);
}
private void setupControl() {
this.playerControl = new BetterCharacterControl(0.5f, 1.0f, 8.0f);
this.addControl((Control)this.playerControl);
this.collision = new GhostControl((CollisionShape)new CapsuleCollisionShape(1.0f, 0.5f));
this.collision.addCollideWithGroup(2);
this.addControl((Control)this.collision);
Exchange.bulletAppState.getPhysicsSpace().add((Object)this.collision);
}
public void setupModelControl() {
this.modelAnimControl = (AnimControl)this.model.getControl(AnimControl.class);
this.modelAnimChannel = this.modelAnimControl.createChannel();
this.modelAnimChannel.setAnim("stand");
}
public void heal(float amount) {
this.health = amount + this.health > MAX_HEALTH ? MAX_HEALTH : (this.health += amount);
}
}
+92
View File
@@ -0,0 +1,92 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.jme3.animation.AnimControl
* com.jme3.bullet.collision.shapes.CapsuleCollisionShape
* com.jme3.bullet.collision.shapes.CollisionShape
* com.jme3.bullet.control.GhostControl
* com.jme3.effect.ParticleEmitter
* com.jme3.effect.ParticleMesh$Type
* com.jme3.material.Material
* com.jme3.math.ColorRGBA
* com.jme3.math.Quaternion
* com.jme3.math.Vector3f
* com.jme3.scene.Spatial
* com.jme3.scene.control.Control
*/
package mygame;
import com.jme3.animation.AnimControl;
import com.jme3.bullet.collision.shapes.CapsuleCollisionShape;
import com.jme3.bullet.collision.shapes.CollisionShape;
import com.jme3.bullet.control.GhostControl;
import com.jme3.effect.ParticleEmitter;
import com.jme3.effect.ParticleMesh;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.scene.Spatial;
import com.jme3.scene.control.Control;
import mygame.Character;
import mygame.Exchange;
public class PowerUpShield
extends Character {
public GhostControl collision;
public PowerUpShield(String name) {
super(name);
this.setModel();
this.setupControl();
}
public void setupModelControl() {
this.modelAnimControl = (AnimControl)this.model.getControl(AnimControl.class);
this.modelAnimChannel = this.modelAnimControl.createChannel();
this.modelAnimChannel.setAnim("normal");
this.modelAnimChannel.setSpeed(0.5f);
}
void setupModel() {
this.wholeBody.attachChild(this.model);
}
public void setupControl() {
this.collision = new GhostControl((CollisionShape)new CapsuleCollisionShape(1.0f, 0.5f));
this.collision.addCollideWithGroup(2);
this.addControl((Control)this.collision);
Exchange.bulletAppState.getPhysicsSpace().add((Object)this.collision);
}
public void setModel() {
this.model = Exchange.assetManager.loadModel("Models/shield/shield.mesh.j3o");
this.model.setMaterial(Exchange.assetManager.loadMaterial("Materials/PowerUpShield.j3m"));
this.model.rotate(new Quaternion().fromAngleAxis((float)Math.PI, new Vector3f(0.0f, 1.0f, 0.0f)));
this.model.setLocalTranslation(0.0f, 1.0f, 0.0f);
this.setLocalScale(0.5f);
this.setupModel();
this.setupModelControl();
this.wholeBody.attachChild(this.model);
ParticleEmitter bobble = new ParticleEmitter("Emitter", ParticleMesh.Type.Triangle, 1);
Material mat_red = Exchange.assetManager.loadMaterial("Materials/bubble.j3m");
bobble.setMaterial(mat_red);
bobble.setImagesX(1);
bobble.setImagesY(1);
bobble.setEndColor(new ColorRGBA(1.0f, 1.0f, 0.0f, 0.75f));
bobble.setStartColor(new ColorRGBA(1.0f, 1.0f, 0.0f, 1.0f));
bobble.getParticleInfluencer().setInitialVelocity(new Vector3f(0.0f, 0.0f, 0.0f));
bobble.setStartSize(1.0f);
bobble.setEndSize(1.1f);
bobble.setGravity(0.0f, 0.0f, 0.0f);
bobble.setLowLife(1.0f);
bobble.setHighLife(1.0f);
bobble.getParticleInfluencer().setVelocityVariation(0.0f);
this.attachChild((Spatial)bobble);
}
public void kill() {
this.removeFromParent();
}
}
+32
View File
@@ -0,0 +1,32 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.jme3.animation.AnimChannel
* com.jme3.animation.AnimControl
* com.jme3.animation.AnimEventListener
*/
package mygame;
import com.jme3.animation.AnimChannel;
import com.jme3.animation.AnimControl;
import com.jme3.animation.AnimEventListener;
import mygame.Weapon;
public class SkillListener
implements AnimEventListener {
private Weapon weapon;
public SkillListener(Weapon w) {
this.weapon = w;
}
public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) {
if (animName.equals("skill1")) {
this.weapon.skill1 = false;
}
}
public void onAnimChange(AnimControl control, AnimChannel channel, String animName) {
}
}
+76
View File
@@ -0,0 +1,76 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.jme3.animation.LoopMode
* com.jme3.asset.AssetManager
* com.jme3.audio.AudioNode
* com.jme3.bullet.control.GhostControl
* com.jme3.math.Ray
* com.jme3.math.Vector3f
* com.jme3.scene.Spatial
*/
package mygame;
import com.jme3.animation.LoopMode;
import com.jme3.asset.AssetManager;
import com.jme3.audio.AudioNode;
import com.jme3.bullet.control.GhostControl;
import com.jme3.math.Ray;
import com.jme3.math.Vector3f;
import com.jme3.scene.Spatial;
import mygame.Exchange;
import mygame.Fireball;
import mygame.Player;
import mygame.Weapon;
public class Staff
extends Weapon {
GhostControl ghost;
AssetManager assetManager;
public Staff(String name) {
super(name);
}
public Staff(String name, AssetManager am, Exchange ex) {
super(name);
this.assetManager = am;
this.exchange = ex;
this.COOLDOWN1_TIME = 5.0f;
this.COOLDOWN2_TIME = 50.0f;
}
protected void setupControl() {
}
public void skill1() {
if (this.cooldown1 <= 0.0f) {
this.cooldown1 = this.COOLDOWN1_TIME;
this.modelAnimChannel.setAnim("skill1");
Player player = (Player)this.getParent().getParent();
Ray ray = new Ray(this.getWorldTranslation(), player.pt);
Vector3f direction = player.pt.subtract(this.getWorldTranslation()).normalize().mult(25.0f);
direction.setY(0.0f);
this.modelAnimChannel.setLoopMode(LoopMode.DontLoop);
Fireball fireball = new Fireball(this.assetManager, direction, player.getLocalTranslation(), this.exchange);
}
}
public void skill2() {
if (this.cooldown2 <= 0.0f) {
this.cooldown2 = this.COOLDOWN2_TIME;
AudioNode hit = new AudioNode(this.assetManager, "Sounds/Effects/teleport.ogg", false);
hit.setLooping(false);
hit.setPositional(true);
hit.setLocalTranslation(this.getLocalTranslation());
hit.setVolume(5.0f);
this.attachChild((Spatial)hit);
hit.play();
Player player = (Player)Exchange.getRootNode().getChild("Player");
Vector3f place = player.pt;
place.setY(1.0f);
player.playerControl.warp(place);
}
}
}
+91
View File
@@ -0,0 +1,91 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.jme3.animation.AnimEventListener
* com.jme3.animation.LoopMode
* com.jme3.asset.AssetManager
* com.jme3.audio.AudioNode
* com.jme3.bullet.collision.shapes.BoxCollisionShape
* com.jme3.bullet.collision.shapes.CollisionShape
* com.jme3.bullet.control.GhostControl
* com.jme3.math.Vector3f
* com.jme3.scene.Spatial
* com.jme3.scene.control.Control
*/
package mygame;
import com.jme3.animation.AnimEventListener;
import com.jme3.animation.LoopMode;
import com.jme3.asset.AssetManager;
import com.jme3.audio.AudioNode;
import com.jme3.bullet.collision.shapes.BoxCollisionShape;
import com.jme3.bullet.collision.shapes.CollisionShape;
import com.jme3.bullet.control.GhostControl;
import com.jme3.math.Vector3f;
import com.jme3.scene.Spatial;
import com.jme3.scene.control.Control;
import mygame.Exchange;
import mygame.Player;
import mygame.SkillListener;
import mygame.WalkingEnemy;
import mygame.Weapon;
public class Sword
extends Weapon
implements Runnable {
GhostControl ghost;
AssetManager assetManager;
public Sword(String name) {
super(name);
}
public Sword(String name, AssetManager am, Exchange ex) {
super(name);
this.assetManager = am;
this.exchange = ex;
this.COOLDOWN1_TIME = 0.5f;
}
protected void setupControl() {
this.ghost = new GhostControl((CollisionShape)new BoxCollisionShape(new Vector3f(0.25f, 0.25f, 1.75f)));
this.ghost.addCollideWithGroup(1);
this.addControl((Control)this.ghost);
this.modelAnimControl.addListener((AnimEventListener)new SkillListener(this));
}
public void skill1() {
if (this.cooldown1 <= 0.0f && !this.skill1) {
this.skill1 = true;
this.cooldown1 = this.COOLDOWN1_TIME;
this.modelAnimChannel.setAnim("skill1");
this.modelAnimChannel.setSpeed(2.0f);
this.modelAnimChannel.setLoopMode(LoopMode.DontLoop);
AudioNode hit = new AudioNode(this.assetManager, "Sounds/Effects/sword_hit1.ogg", false);
hit.setLooping(false);
hit.setPositional(true);
hit.setLocalTranslation(this.getLocalTranslation());
hit.setVolume(5.0f);
this.attachChild((Spatial)hit);
hit.play();
int i = 0;
while (true) {
if (i >= Exchange.enemies.size()) break;
WalkingEnemy enemy = Exchange.enemies.get(i);
if (this.ghost.getOverlappingObjects().contains(enemy.ghost)) {
enemy.doDamage(50.0f);
Player player = (Player)this.getParent().getParent();
}
++i;
}
}
}
public void run() {
this.skill1();
}
public void skill2() {
}
}
+152
View File
@@ -0,0 +1,152 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.jme3.animation.AnimControl
* com.jme3.animation.LoopMode
* com.jme3.app.Application
* com.jme3.asset.AssetManager
* com.jme3.audio.AudioNode
* com.jme3.bullet.collision.shapes.CapsuleCollisionShape
* com.jme3.bullet.collision.shapes.CollisionShape
* com.jme3.bullet.control.BetterCharacterControl
* com.jme3.bullet.control.GhostControl
* com.jme3.effect.ParticleEmitter
* com.jme3.effect.ParticleMesh$Type
* com.jme3.material.Material
* com.jme3.math.ColorRGBA
* com.jme3.math.Vector3f
* com.jme3.scene.Spatial
* com.jme3.scene.control.Control
* tonegod.gui.core.Screen
*/
package mygame;
import com.jme3.animation.AnimControl;
import com.jme3.animation.LoopMode;
import com.jme3.app.Application;
import com.jme3.asset.AssetManager;
import com.jme3.audio.AudioNode;
import com.jme3.bullet.collision.shapes.CapsuleCollisionShape;
import com.jme3.bullet.collision.shapes.CollisionShape;
import com.jme3.bullet.control.BetterCharacterControl;
import com.jme3.bullet.control.GhostControl;
import com.jme3.effect.ParticleEmitter;
import com.jme3.effect.ParticleMesh;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Spatial;
import com.jme3.scene.control.Control;
import mygame.Character;
import mygame.Exchange;
import mygame.WalkingEnemyControl;
import tonegod.gui.core.Screen;
public class WalkingEnemy
extends Character {
public BetterCharacterControl walkingEnemyControl;
public GhostControl ghost;
private WalkingEnemyControl control = new WalkingEnemyControl();
private float health;
private AssetManager assetManager;
public float reverseWalk;
public ParticleEmitter blood;
public boolean dead = false;
public float deadtimer = 0.0f;
public WalkingEnemy(String name) {
super(name);
this.addControl((Control)this.control);
}
public WalkingEnemy(String name, AssetManager am) {
super(name);
this.addControl((Control)this.control);
this.assetManager = am;
}
public void setupModelControl() {
this.modelAnimControl = (AnimControl)this.model.getControl(AnimControl.class);
this.modelAnimChannel = this.modelAnimControl.createChannel();
this.modelAnimChannel.setAnim("stand");
}
public void setupGUI() {
Screen screen = new Screen((Application)Exchange.app, "tonegod/gui/style/def/style_map.xml");
}
public void setModel(Spatial model) {
this.model = model;
this.setupModel();
this.setupControl();
this.setupModelControl();
this.wholeBody.attachChild(this.model);
this.blood = new ParticleEmitter("Emitter", ParticleMesh.Type.Triangle, 10);
Material mat_red = this.assetManager.loadMaterial("Materials/blood.j3m");
this.blood.setMaterial(mat_red);
this.blood.setImagesX(2);
this.blood.setImagesY(2);
this.blood.setEndColor(new ColorRGBA(1.0f, 0.0f, 0.0f, 0.75f));
this.blood.setStartColor(new ColorRGBA(1.0f, 0.0f, 0.0f, 0.25f));
this.blood.getParticleInfluencer().setInitialVelocity(new Vector3f(1.0f, 2.0f, 1.0f));
this.blood.setParticlesPerSec(0.0f);
this.blood.setStartSize(1.0f);
this.blood.setEndSize(1.0f);
this.blood.setGravity(0.0f, 2.0f, 0.0f);
this.blood.setLowLife(1.0f);
this.blood.setHighLife(0.5f);
this.blood.getParticleInfluencer().setVelocityVariation(0.3f);
this.blood.setRandomAngle(true);
this.blood.setSelectRandomImage(true);
this.attachChild((Spatial)this.blood);
}
void setupModel() {
this.model.setLocalScale(0.5f);
this.wholeBody.attachChild(this.model);
}
private void setupControl() {
this.walkingEnemyControl = new BetterCharacterControl(1.0f, 2.0f, 8.0f);
this.addControl((Control)this.walkingEnemyControl);
this.ghost = new GhostControl((CollisionShape)new CapsuleCollisionShape(1.0f, 0.5f));
this.ghost.addCollideWithGroup(1);
this.addControl((Control)this.ghost);
}
public float getHealth() {
return this.health;
}
public void setHealth(float health) {
this.health = health;
}
public void doDamage(float damage) {
this.health -= damage;
this.reverseWalk = 0.5f;
if (this.health <= 0.0f) {
this.die();
}
AudioNode hit = new AudioNode(this.assetManager, "Sounds/Effects/damage.ogg", false);
hit.setLooping(false);
hit.setVolume(100.0f);
this.getParent().attachChild((Spatial)hit);
hit.play();
this.blood.emitAllParticles();
}
public void die() {
this.modelAnimChannel.setAnim("die");
this.modelAnimChannel.setLoopMode(LoopMode.DontLoop);
this.ghost.setEnabled(false);
this.walkingEnemyControl.setEnabled(false);
AudioNode an = (AudioNode)this.getChild("walkingSound");
an.stop();
Exchange.removeEnemy(this);
Exchange.setKilled(Exchange.killed + 1);
Exchange.spawnItem(this.getLocalTranslation());
this.dead = true;
}
}
@@ -0,0 +1,42 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.jme3.math.Vector3f
* com.jme3.renderer.RenderManager
* com.jme3.renderer.ViewPort
* com.jme3.scene.control.AbstractControl
*/
package mygame;
import com.jme3.math.Vector3f;
import com.jme3.renderer.RenderManager;
import com.jme3.renderer.ViewPort;
import com.jme3.scene.control.AbstractControl;
import mygame.WalkingEnemy;
public class WalkingEnemyControl
extends AbstractControl {
public WalkingEnemy walkingEnemy;
protected void controlUpdate(float tpf) {
this.walkingEnemy = (WalkingEnemy)this.spatial;
if (!this.walkingEnemy.dead) {
Vector3f walkdirection = new Vector3f(this.walkingEnemy.walkingEnemyControl.getViewDirection().x, 0.0f, this.walkingEnemy.walkingEnemyControl.getViewDirection().z).normalize().mult(6.0f);
if (this.walkingEnemy.reverseWalk > 0.0f) {
walkdirection.negateLocal();
this.walkingEnemy.reverseWalk -= tpf;
}
this.walkingEnemy.walkingEnemyControl.setViewDirection(this.spatial.getParent().getChild("Player").getLocalTranslation().subtract(this.spatial.getLocalTranslation()));
this.walkingEnemy.walkingEnemyControl.setWalkDirection(walkdirection);
} else {
this.walkingEnemy.deadtimer += tpf;
if (this.walkingEnemy.deadtimer > 10.0f) {
this.walkingEnemy.removeFromParent();
}
}
}
protected void controlRender(RenderManager rm, ViewPort vp) {
}
}
+73
View File
@@ -0,0 +1,73 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.jme3.animation.AnimControl
* com.jme3.bullet.control.GhostControl
* com.jme3.scene.Spatial
*/
package mygame;
import com.jme3.animation.AnimControl;
import com.jme3.bullet.control.GhostControl;
import com.jme3.scene.Spatial;
import mygame.Character;
import mygame.Exchange;
public abstract class Weapon
extends Character {
GhostControl weaponControl;
public Exchange exchange;
public boolean skill1 = false;
public float cooldown1 = 0.0f;
public float cooldown2 = 0.0f;
public float cooldown3 = 0.0f;
public float COOLDOWN1_TIME = 0.0f;
public float COOLDOWN2_TIME = 0.0f;
public float COOLDOWN3_TIME = 0.0f;
public Weapon(String name) {
super(name);
}
public Weapon(String name, Exchange ex) {
super(name);
this.exchange = ex;
}
public void setModel(Spatial model) {
this.model = model;
this.setupModel();
this.setupModelControl();
this.setupControl();
this.wholeBody.attachChild(this.model);
}
protected abstract void setupControl();
public void setupModelControl() {
this.modelAnimControl = (AnimControl)this.model.getControl(AnimControl.class);
this.modelAnimChannel = this.modelAnimControl.createChannel();
this.modelAnimChannel.setAnim("normal");
}
void setupModel() {
this.wholeBody.attachChild(this.model);
}
public void reduceCooldowns(float tpf) {
if (this.cooldown1 > 0.0f) {
this.cooldown1 -= tpf;
}
if (this.cooldown2 > 0.0f) {
this.cooldown2 -= tpf;
}
if (this.cooldown3 > 0.0f) {
this.cooldown3 -= tpf;
}
}
public abstract void skill1();
public abstract void skill2();
}
+44
View File
@@ -0,0 +1,44 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.jme3.app.SimpleApplication
* com.jme3.material.Material
* com.jme3.math.Quaternion
* com.jme3.math.Vector3f
* com.jme3.scene.Geometry
* com.jme3.scene.Mesh
* com.jme3.scene.Spatial
* com.jme3.scene.shape.Quad
*/
package mygame;
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.Mesh;
import com.jme3.scene.Spatial;
import com.jme3.scene.shape.Quad;
public class test1
extends SimpleApplication {
private Spatial player;
public static void main(String[] args) {
test1 app = new test1();
app.start();
}
public void simpleInitApp() {
this.player = this.assetManager.loadModel("Models/blob/Blob.mesh.xml");
Material mat_ground = new Material(this.assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat_ground.setTexture("ColorMap", this.assetManager.loadTexture("Textures/Rock.PNG"));
Geometry ground = new Geometry("ground", (Mesh)new Quad(50.0f, 50.0f));
ground.setLocalRotation(new Quaternion().fromAngleAxis(-1.5707964f, Vector3f.UNIT_X));
ground.setLocalTranslation(-25.0f, -1.0f, 25.0f);
ground.setMaterial(mat_ground);
this.rootNode.attachChild((Spatial)ground);
}
}