Skip to content

Commit

Permalink
Added moleman lifecycle; not content with how gameplay works
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Bârsan committed Apr 27, 2014
1 parent 3269ab9 commit 3466240
Show file tree
Hide file tree
Showing 14 changed files with 510 additions and 95 deletions.
Binary file added assets/img/moleman02-dead.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/moleman02-falling.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/particles/pixel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/particles/puff01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
132 changes: 132 additions & 0 deletions assets/particleEffects/blast
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
mainBlast
- Delay -
active: false
- Duration -
lowMin: 100.0
lowMax: 100.0
- Count -
min: 0
max: 20
- Emission -
lowMin: 0.0
lowMax: 0.0
highMin: 500.0
highMax: 500.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Life -
lowMin: 0.0
lowMax: 0.0
highMin: 500.0
highMax: 700.0
relative: false
scalingCount: 3
scaling0: 1.0
scaling1: 1.0
scaling2: 1.0
timelineCount: 3
timeline0: 0.0
timeline1: 0.66
timeline2: 1.0
- Life Offset -
active: false
- X Offset -
active: false
- Y Offset -
active: false
- Spawn Shape -
shape: point
- Spawn Width -
lowMin: 0.0
lowMax: 0.0
highMin: 0.0
highMax: 0.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Spawn Height -
lowMin: 0.0
lowMax: 0.0
highMin: 0.0
highMax: 0.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Scale -
lowMin: 0.0
lowMax: 0.0
highMin: 8.0
highMax: 8.0
relative: false
scalingCount: 2
scaling0: 1.0
scaling1: 0.0
timelineCount: 2
timeline0: 0.0
timeline1: 1.0
- Velocity -
active: true
lowMin: 0.0
lowMax: 0.0
highMin: 10.0
highMax: 100.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Angle -
active: true
lowMin: 0.0
lowMax: 0.0
highMin: -35.0
highMax: -155.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Rotation -
active: false
- Wind -
active: false
- Gravity -
active: false
- Tint -
colorsCount: 3
colors0: 0.6392157
colors1: 0.45490196
colors2: 0.14509805
timelineCount: 1
timeline0: 0.0
- Transparency -
lowMin: 0.0
lowMax: 0.0
highMin: 1.0
highMax: 1.0
relative: false
scalingCount: 4
scaling0: 0.0
scaling1: 0.84210527
scaling2: 0.50877196
scaling3: 0.0
timelineCount: 4
timeline0: 0.0
timeline1: 0.23287672
timeline2: 0.8356164
timeline3: 1.0
- Options -
attached: false
continuous: false
aligned: false
additive: true
behind: false
- Image Path -
C:\Users\SiegeDog\Documents\java_workspace\libgdx\Lemonade\assets\img\particles\pixel.png
158 changes: 158 additions & 0 deletions assets/particleEffects/puff
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
Untitled
- Delay -
active: false
- Duration -
lowMin: 150.0
lowMax: 150.0
- Count -
min: 0
max: 200
- Emission -
lowMin: 0.0
lowMax: 0.0
highMin: 350.0
highMax: 350.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Life -
lowMin: 0.0
lowMax: 0.0
highMin: 600.0
highMax: 900.0
relative: false
scalingCount: 3
scaling0: 1.0
scaling1: 1.0
scaling2: 1.0
timelineCount: 3
timeline0: 0.0
timeline1: 0.66
timeline2: 1.0
- Life Offset -
active: true
lowMin: 0.0
lowMax: 0.0
highMin: 0.0
highMax: 0.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- X Offset -
active: false
- Y Offset -
active: false
- Spawn Shape -
shape: point
- Spawn Width -
lowMin: 0.0
lowMax: 0.0
highMin: 0.0
highMax: 0.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Spawn Height -
lowMin: 0.0
lowMax: 0.0
highMin: 0.0
highMax: 0.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Scale -
lowMin: 0.0
lowMax: 0.0
highMin: 16.0
highMax: 16.0
relative: false
scalingCount: 2
scaling0: 0.50980395
scaling1: 1.0
timelineCount: 2
timeline0: 0.0
timeline1: 1.0
- Velocity -
active: true
lowMin: 0.0
lowMax: 0.0
highMin: 20.0
highMax: 90.0
relative: false
scalingCount: 3
scaling0: 1.0
scaling1: 0.627451
scaling2: 0.0
timelineCount: 3
timeline0: 0.0
timeline1: 0.6643836
timeline2: 0.9315069
- Angle -
active: true
lowMin: 90.0
lowMax: 90.0
highMin: 0.0
highMax: 360.0
relative: false
scalingCount: 2
scaling0: 1.0
scaling1: 1.0
timelineCount: 2
timeline0: 0.0
timeline1: 0.999
- Rotation -
active: true
lowMin: 1.0
lowMax: 360.0
highMin: 180.0
highMax: 180.0
relative: true
scalingCount: 2
scaling0: 0.0
scaling1: 1.0
timelineCount: 2
timeline0: 0.0
timeline1: 1.0
- Wind -
active: false
- Gravity -
active: false
- Tint -
colorsCount: 3
colors0: 1.0
colors1: 1.0
colors2: 1.0
timelineCount: 1
timeline0: 0.0
- Transparency -
lowMin: 0.0
lowMax: 0.0
highMin: 1.0
highMax: 1.0
relative: false
scalingCount: 4
scaling0: 0.0
scaling1: 0.61403507
scaling2: 0.4385965
scaling3: 0.0
timelineCount: 4
timeline0: 0.0
timeline1: 0.21232876
timeline2: 0.8150685
timeline3: 1.0
- Options -
attached: true
continuous: false
aligned: false
additive: false
behind: false
- Image Path -
C:\Users\SiegeDog\Documents\java_workspace\libgdx\Lemonade\assets\img\particles\puff01.png
3 changes: 3 additions & 0 deletions src/com/siegedog/lemonade/LemonadeGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public void performLoad(Resources r) {
r.loadFont("menuFont");
r.loadFont("splashFont");
r.loadAtlas("img/atlas/pack.atlas");

r.loadParticleEffect("puff");
r.loadParticleEffect("blast");
}
};

Expand Down
12 changes: 11 additions & 1 deletion src/com/siegedog/lemonade/data/Waves.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ public interface Wave {
public void schedule(MoleGame screen);
}

private static Action done(final MoleGame screen) {
return new Action() {
public boolean act(float delta) {
screen.doneSpawning();
return true;
}
};
}

private static Action spawnBasicMolemen(final MoleGame screen, final Vector2... positions) {
return new Action() {
public boolean act(float delta) {
Expand All @@ -31,7 +40,8 @@ public void schedule(MoleGame screen) {
screen.getStage().addAction(Actions.sequence(
spawnBasicMolemen(screen, new Vector2(-50.0f, BOTTOM), new Vector2(RIGHT + 50.0f, BOTTOM)),
Actions.delay(2.0f),
spawnBasicMolemen(screen, new Vector2(-50.0f, BOTTOM), new Vector2(RIGHT + 50.0f, BOTTOM))
spawnBasicMolemen(screen, new Vector2(-50.0f, BOTTOM), new Vector2(RIGHT + 50.0f, BOTTOM)),
done(screen)
));
}
};
Expand Down
21 changes: 17 additions & 4 deletions src/com/siegedog/lemonade/entities/BasicMole.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@

import com.badlogic.gdx.math.Interpolation;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.Action;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.siegedog.egglib.EggGame;
import com.siegedog.egglib.physics.AABB;

public class BasicMole extends Moleman {

static final float WALKING_SPEED = 60.0f;
static final float JETPACK_SPEED = 50.0f;
static final float WALKING_SPEED = 30.0f;
static final float JETPACK_SPEED = 28.0f;

public BasicMole(float x, float y) {
super(EggGame.R.spriteAsAnimatedSprite("moleman02"), new AABB(x, y, 22, 52), new Vector2(-8.0f, -10.0f), 150);
super(EggGame.R.spriteAsAnimatedSprite("moleman02"),
EggGame.R.spriteAsAnimatedSprite("moleman02-falling"),
EggGame.R.spriteAsAnimatedSprite("moleman02-dead"),
new AABB(x, y, 22, 52),
new Vector2(-16.0f, 0.0f),
150);

float width = 512;
float border = 32;
Expand All @@ -21,12 +27,19 @@ public BasicMole(float x, float y) {
// For the jetpack jump effect
float overTheTop = 10.0f + (float) (Math.random() * 15.0f);

if(chosenX > x) {
sprite.flip(false, false);
} else {
sprite.flip(true, false);
}

// TODO: not hack this shit
float walkwayY = -110.0f;
addAction(Actions.sequence(
Actions.moveTo(chosenX, y, Math.abs(x - chosenX) / WALKING_SPEED, Interpolation.pow2),
Actions.delay(0.5f),
Actions.moveTo(chosenX, walkwayY + overTheTop, Math.abs(y - walkwayY - overTheTop) / JETPACK_SPEED, Interpolation.pow2),
new Action() { public boolean act(float delta) { state = State.Jetpacking; return true; } },
Actions.moveTo(chosenX, walkwayY + overTheTop, Math.abs(y - walkwayY - overTheTop) / JETPACK_SPEED, Interpolation.linear),
Actions.moveTo(chosenX, walkwayY, overTheTop / JETPACK_SPEED, Interpolation.pow2)
));
}
Expand Down
Loading

0 comments on commit 3466240

Please sign in to comment.