This file contains hidden or 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
const express = require('express'); | |
const path = require('path'); | |
const fs = require('fs'); | |
const cors = require('cors'); | |
const util = require('util'); | |
const fspro = require('fs').promises; | |
const app = express(); | |
const PORT = 3000; | |
app.use(cors()); |
This file contains hidden or 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
def methodThatCreatesAst(Statement statementToWrap) { | |
BlockStatement methodBody = new BlockStatement() | |
methodBody.addStatement(new TryCatchStatement( | |
// try | |
statementToWrap, | |
// finally | |
new ExpressionStatement( | |
new MethodCallExpression( | |
new ConstantExpression("myVar") |
This file contains hidden or 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
@Test | |
public void test_interval_delta_when_world_step_is_bigger_than_system_interval() { | |
IntervalSystem intervalSystem = new IntervalSystem(); | |
World world = new World(new WorldConfiguration() | |
.setSystem(intervalSystem)); | |
float worldTotalTime=0; | |
float intervalSystemTotalIntervalTime=0; | |
for (int i = 0; i < 4; i++) { | |
world.delta = 2f; |
This file contains hidden or 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
protected void process(Entity e) { | |
// TODO if baseBody was destroyed then disable rotation | |
StationaryGunMotorComponent gunComponent = components.get(e); | |
Box2dBodyComponent bodyComponent = Box2dBodySystem.components.get(e); | |
float desiredWorldAngle = gunComponent.getDesiredWorldAngleRads(); | |
float currWorldAngle = MathUtilsExt.absRadians(bodyComponent.body.getAngle()); | |
float angleDelta = MathUtilsExt.diffAbsoluteRadians(currWorldAngle, desiredWorldAngle); | |
if (MathUtilsExt.areDecimalsEqual(angleDelta, 0)) { | |
return; |
This file contains hidden or 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
protected void process(Entity e) { | |
// TODO if baseBody was destroyed then disable rotation | |
StationaryGunComponent gunComponent = components.get(e); | |
Box2dBodyComponent bodyComponent = Box2dBodySystem.components.get(e); | |
float expectedWorldAngle = gunComponent.getExpectedWorldAngleRads(); | |
float currWorldAngle = bodyComponent.body.getAngle(); | |
float angleDelta = MathUtilsExt.diffAbsoluteRadians(currWorldAngle, expectedWorldAngle); | |
float absDelta = Math.abs(angleDelta); |
This file contains hidden or 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
public class AiStaticAttackHelper { | |
private static final Vector2 posDiff = new Vector2(); | |
public static void step(Entity attackerE, int targetE) { | |
Box2dBodyComponent attackerBody = Box2dBodySystem.components.get(attackerE); | |
Box2dBodyComponent targetBody = Box2dBodySystem.components.get(targetE); | |
Vector2 attackerPos = attackerBody.body.getPosition(); | |
Vector2 targetPos = targetBody.body.getPosition(); | |
posDiff.set(targetPos).sub(attackerPos); |
This file contains hidden or 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
import com.artemis.Entity; | |
import com.badlogic.gdx.math.Vector2; | |
import conversion7.gdxg.engine.utils.MathUtilsExt; | |
import conversion7.spashole.game.artemis_odb.box2d.Box2dBodyComponent; | |
import conversion7.spashole.game.artemis_odb.box2d.Box2dBodySystem; | |
import conversion7.spashole.game.utils.SpasholeUtils; | |
public class AiAttackSystem { | |
public static final Vector2 posDiff = new Vector2(); |
This file contains hidden or 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
public void draw(GameScene activeStage, float delta) { | |
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); | |
Gdx.gl.glClearColor(1, 1, 1, 1); | |
CommonApp.postProcessor.capture(); | |
CommonApp.glPrimitiveRenderer.begin(getCameraController().getCamera().combined, GL20.GL_LINES); | |
CommonApp.modelBatch.begin(getCameraController().getCamera()); | |
if (activeStage != null) { |
This file contains hidden or 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
public class ShipAiManager extends Manager { | |
public static ComponentMapper<ShipAiComponent> components; | |
public static final TestObstacles TEST_OBSTACLES = new TestObstacles(); | |
private static Vector2 moveDirectionWip = new Vector2(); | |
private static Vector2 start = new Vector2(); | |
private static Vector2 finish = new Vector2(); | |
private static float TEST_DISTANCE = SpasholeUtils.sceneToWorld(242f); | |
private static float MOVE_STEP_DISTANCE = SpasholeUtils.sceneToWorld(42f); | |
public static void process(int entityId) { |
This file contains hidden or 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
public abstract class AbstractQuest { | |
protected static int QUEST_INIT_STATE = 0; | |
protected static int QUEST_COMPLETED_STATE = Integer.MAX_VALUE; | |
private boolean toBeCompleted; | |
private Array<QuestOption> choiceItems = PoolManager.ARRAYS_POOL.obtain(); | |
private Array<String> descriptionRows = PoolManager.ARRAYS_POOL.obtain(); | |
private Texture picture; | |
public QuestWindow questWindow; |