v0.4.3: plants and traps are now on a terrain tilemap pt.2

This commit is contained in:
Evan Debenham 2016-10-08 18:11:23 -04:00
parent fef73210e9
commit 4bc9a0c453
37 changed files with 88 additions and 323 deletions

View File

@ -753,7 +753,6 @@ public abstract class Level implements Bundlable {
Trap existingTrap = traps.get(pos);
if (existingTrap != null){
traps.remove( pos );
if(existingTrap.sprite != null) existingTrap.sprite.kill();
}
trap.set( pos );
traps.put( pos, trap );

View File

@ -26,15 +26,14 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
public class AlarmTrap extends Trap {
{
color = TrapSprite.RED;
shape = TrapSprite.DOTS;
color = RED;
shape = DOTS;
}
@Override

View File

@ -21,14 +21,12 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.traps;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlameParticle;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.PathFinder;
@ -36,8 +34,8 @@ import com.watabou.utils.PathFinder;
public class BlazingTrap extends Trap {
{
color = TrapSprite.ORANGE;
shape = TrapSprite.STARS;
color = ORANGE;
shape = STARS;
}

View File

@ -28,7 +28,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Chill;
import com.shatteredpixel.shatteredpixeldungeon.effects.Splash;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Random;
@ -36,14 +35,14 @@ import com.watabou.utils.Random;
public class ChillingTrap extends Trap{
{
color = TrapSprite.WHITE;
shape = TrapSprite.DOTS;
color = WHITE;
shape = DOTS;
}
@Override
public void activate() {
if (Dungeon.visible[ pos ]){
Splash.at( sprite.center(), 0xFFB2D6FF, 5);
Splash.at( pos, 0xFFB2D6FF, 5);
Sample.INSTANCE.play( Assets.SND_SHATTER );
}

View File

@ -24,13 +24,12 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ConfusionGas;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
public class ConfusionTrap extends Trap {
{
color = TrapSprite.TEAL;
shape = TrapSprite.GRILL;
color = TEAL;
shape = GRILL;
}
@Override

View File

@ -36,7 +36,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Boomerang;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Random;
@ -47,8 +46,8 @@ import java.util.Collections;
public class CursingTrap extends Trap {
{
color = TrapSprite.VIOLET;
shape = TrapSprite.WAVES;
color = VIOLET;
shape = WAVES;
}
@Override

View File

@ -29,10 +29,8 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Knuckles;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.PathFinder;
@ -40,8 +38,8 @@ import com.watabou.utils.PathFinder;
public class DisarmingTrap extends Trap{
{
color = TrapSprite.RED;
shape = TrapSprite.LARGE_DOT;
color = RED;
shape = LARGE_DOT;
}
@Override

View File

@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.traps;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.DungeonTilemap;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
@ -30,9 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Beam;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Random;
@ -40,17 +39,17 @@ import com.watabou.utils.Random;
public class DisintegrationTrap extends Trap {
{
color = TrapSprite.VIOLET;
shape = TrapSprite.LARGE_DOT;
color = VIOLET;
shape = LARGE_DOT;
}
@Override
public void activate() {
if (Dungeon.visible[ pos ]) {
sprite.parent.add( new Beam.DeathRay( DungeonTilemap.tileCenterToWorld(pos-1),
ShatteredPixelDungeon.scene().add( new Beam.DeathRay( DungeonTilemap.tileCenterToWorld(pos-1),
DungeonTilemap.tileCenterToWorld(pos+1)));
sprite.parent.add(new Beam.DeathRay(DungeonTilemap.tileCenterToWorld(pos - Dungeon.level.width()),
ShatteredPixelDungeon.scene().add(new Beam.DeathRay(DungeonTilemap.tileCenterToWorld(pos - Dungeon.level.width()),
DungeonTilemap.tileCenterToWorld(pos + Dungeon.level.width())));
Sample.INSTANCE.play( Assets.SND_RAY );
}

View File

@ -25,14 +25,13 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.LloydsBeacon;
import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
import com.watabou.noosa.Game;
public class DistortionTrap extends Trap{
{
color = TrapSprite.TEAL;
shape = TrapSprite.LARGE_DOT;
color = TEAL;
shape = LARGE_DOT;
}
@Override

View File

@ -21,13 +21,12 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.traps;
import com.shatteredpixel.shatteredpixeldungeon.items.Bomb;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
public class ExplosiveTrap extends Trap {
{
color = TrapSprite.ORANGE;
shape = TrapSprite.DIAMOND;
color = ORANGE;
shape = DIAMOND;
}
@Override

View File

@ -25,13 +25,12 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlameParticle;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
public class FireTrap extends Trap {
{
color = TrapSprite.ORANGE;
shape = TrapSprite.DOTS;
color = ORANGE;
shape = DOTS;
}
@Override

View File

@ -31,15 +31,14 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Random;
public class FlashingTrap extends Trap {
{
color = TrapSprite.YELLOW;
shape = TrapSprite.STARS;
color = YELLOW;
shape = STARS;
}
@Override

View File

@ -28,7 +28,6 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.PathFinder;
@ -37,8 +36,8 @@ import com.watabou.utils.Random;
public class FlockTrap extends Trap {
{
color = TrapSprite.WHITE;
shape = TrapSprite.WAVES;
color = WHITE;
shape = WAVES;
}

View File

@ -29,7 +29,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Frost;
import com.shatteredpixel.shatteredpixeldungeon.effects.Splash;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Random;
@ -37,15 +36,15 @@ import com.watabou.utils.Random;
public class FrostTrap extends Trap {
{
color = TrapSprite.WHITE;
shape = TrapSprite.STARS;
color = WHITE;
shape = STARS;
}
@Override
public void activate() {
if (Dungeon.visible[ pos ]){
Splash.at( sprite.center(), 0xFFB2D6FF, 10);
Splash.at( pos, 0xFFB2D6FF, 10);
Sample.INSTANCE.play( Assets.SND_SHATTER );
}

View File

@ -27,10 +27,8 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Callback;
@ -38,8 +36,8 @@ import com.watabou.utils.Callback;
public class GrimTrap extends Trap {
{
color = TrapSprite.GREY;
shape = TrapSprite.LARGE_DOT;
color = GREY;
shape = LARGE_DOT;
}
@Override

View File

@ -28,13 +28,12 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Roots;
import com.shatteredpixel.shatteredpixeldungeon.effects.Wound;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
public class GrippingTrap extends Trap {
{
color = TrapSprite.GREY;
shape = TrapSprite.CROSSHAIR;
color = GREY;
shape = CROSSHAIR;
}
@Override

View File

@ -29,15 +29,14 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.StatueSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
public class GuardianTrap extends Trap {
{
color = TrapSprite.RED;
shape = TrapSprite.STARS;
color = RED;
shape = STARS;
}
@Override

View File

@ -29,9 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.particles.SparkParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.Camera;
import com.watabou.utils.Random;
@ -41,8 +39,8 @@ import java.util.ArrayList;
public class LightningTrap extends Trap {
{
color = TrapSprite.TEAL;
shape = TrapSprite.CROSSHAIR;
color = TEAL;
shape = CROSSHAIR;
}
@Override

View File

@ -25,13 +25,12 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Ooze;
import com.shatteredpixel.shatteredpixeldungeon.effects.Splash;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
public class OozeTrap extends Trap {
{
color = TrapSprite.GREEN;
shape = TrapSprite.DOTS;
color = GREEN;
shape = DOTS;
}
@Override
@ -40,7 +39,7 @@ public class OozeTrap extends Trap {
if (ch != null){
Buff.affect(ch, Ooze.class);
Splash.at(sprite.center(), 0x000000, 5);
Splash.at( pos, 0x000000, 5);
}
}
}

View File

@ -24,13 +24,12 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ParalyticGas;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
public class ParalyticTrap extends Trap{
{
color = TrapSprite.YELLOW;
shape = TrapSprite.GRILL;
color = YELLOW;
shape = GRILL;
}
@Override

View File

@ -24,20 +24,18 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.WindParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
public class PitfallTrap extends Trap {
{
color = TrapSprite.RED;
shape = TrapSprite.DIAMOND;
color = RED;
shape = DIAMOND;
}
@Override
@ -71,8 +69,6 @@ public class PitfallTrap extends Trap {
&& !(Dungeon.level.solid[pos - 1]&& Dungeon.level.solid[pos + 1])){
Level.set(pos, Terrain.CHASM);
sprite.parent.add(new WindParticle.Wind(pos));
sprite.kill();
GameScene.updateMap( pos );
}
}

View File

@ -27,13 +27,12 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Poison;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.PoisonParticle;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
public class PoisonTrap extends Trap{
{
color = TrapSprite.VIOLET;
shape = TrapSprite.CROSSHAIR;
color = VIOLET;
shape = CROSSHAIR;
}
@Override

View File

@ -30,7 +30,6 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.Camera;
import com.watabou.noosa.audio.Sample;
@ -40,8 +39,8 @@ import com.watabou.utils.Random;
public class RockfallTrap extends Trap {
{
color = TrapSprite.GREY;
shape = TrapSprite.DIAMOND;
color = GREY;
shape = DIAMOND;
}
@Override

View File

@ -28,7 +28,6 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Wound;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Random;
@ -36,8 +35,8 @@ import com.watabou.utils.Random;
public class SpearTrap extends Trap {
{
color = TrapSprite.GREY;
shape = TrapSprite.DOTS;
color = GREY;
shape = DOTS;
}
@Override

View File

@ -27,7 +27,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
@ -38,8 +37,8 @@ public class SummoningTrap extends Trap {
private static final float DELAY = 2f;
{
color = TrapSprite.TEAL;
shape = TrapSprite.WAVES;
color = TEAL;
shape = WAVES;
}
@Override

View File

@ -31,15 +31,14 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
public class TeleportationTrap extends Trap {
{
color = TrapSprite.TEAL;
shape = TrapSprite.DOTS;
color = TEAL;
shape = DOTS;
}
@Override

View File

@ -24,13 +24,12 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
public class ToxicTrap extends Trap{
{
color = TrapSprite.GREEN;
shape = TrapSprite.GRILL;
color = GREEN;
shape = GRILL;
}
@Override

View File

@ -24,14 +24,32 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
import com.watabou.noosa.audio.Sample;
import com.watabou.noosa.tweeners.AlphaTweener;
import com.watabou.utils.Bundlable;
import com.watabou.utils.Bundle;
public abstract class Trap implements Bundlable {
//trap colors
public static final int RED = 0;
public static final int ORANGE = 1;
public static final int YELLOW = 2;
public static final int GREEN = 3;
public static final int TEAL = 4;
public static final int VIOLET = 5;
public static final int WHITE = 6;
public static final int GREY = 7;
public static final int BLACK = 8;
//trap shapes
public static final int DOTS = 0;
public static final int WAVES = 1;
public static final int GRILL = 2;
public static final int STARS = 3;
public static final int DIAMOND = 4;
public static final int CROSSHAIR = 5;
public static final int LARGE_DOT = 6;
public String name = Messages.get(this, "name");
public int color;
@ -39,7 +57,6 @@ public abstract class Trap implements Bundlable {
public int pos;
public TrapSprite sprite;
public boolean visible;
public boolean active = true;
@ -50,19 +67,12 @@ public abstract class Trap implements Bundlable {
public Trap reveal() {
visible = true;
if (sprite != null && sprite.visible == false) {
sprite.visible = true;
sprite.alpha( 0 );
sprite.parent.add( new AlphaTweener( sprite, 1, 0.6f));
}
GameScene.updateMap(pos);
return this;
}
public Trap hide() {
visible = false;
if (sprite != null)
sprite.visible = false;
GameScene.updateMap(pos);
return this;
}
@ -83,9 +93,6 @@ public abstract class Trap implements Bundlable {
protected void disarm(){
Dungeon.level.disarmTrap(pos);
active = false;
if (sprite != null) {
sprite.reset( this );
}
}
private static final String POS = "pos";

View File

@ -24,13 +24,12 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.VenomGas;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
public class VenomTrap extends Trap {
{
color = TrapSprite.VIOLET;
shape = TrapSprite.GRILL;
color = VIOLET;
shape = GRILL;
}
@Override

View File

@ -33,7 +33,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass;
import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
import com.watabou.noosa.Game;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Random;
@ -43,8 +42,8 @@ import java.util.ArrayList;
public class WarpingTrap extends Trap {
{
color = TrapSprite.TEAL;
shape = TrapSprite.STARS;
color = TEAL;
shape = STARS;
}
@Override

View File

@ -28,13 +28,12 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Slow;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Weakness;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
public class WeakeningTrap extends Trap{
{
color = TrapSprite.GREEN;
shape = TrapSprite.WAVES;
color = GREEN;
shape = WAVES;
}
@Override

View File

@ -21,14 +21,13 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.traps;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class WornTrap extends Trap {
{
color = TrapSprite.BLACK;
shape = TrapSprite.DOTS;
color = BLACK;
shape = DOTS;
}
@Override

View File

@ -58,8 +58,6 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.DiscardedItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.PlantSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.ActionIndicator;
import com.shatteredpixel.shatteredpixeldungeon.ui.AttackIndicator;
import com.shatteredpixel.shatteredpixeldungeon.ui.Banner;

View File

@ -1,109 +0,0 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2016 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.sprites;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.DungeonTilemap;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
import com.watabou.noosa.Game;
import com.watabou.noosa.Image;
import com.watabou.noosa.TextureFilm;
public class PlantSprite extends Image {
private static final float DELAY = 0.2f;
private static enum State {
GROWING, NORMAL, WITHERING
}
private State state = State.NORMAL;
private float time;
private static TextureFilm frames;
private int pos = -1;
public PlantSprite() {
super( Assets.TERRAIN_FEATURES );
if (frames == null) {
frames = new TextureFilm( texture, 16, 16 );
}
origin.set( 8, 12 );
}
public PlantSprite( int image ) {
this();
reset( image );
}
public void reset( Plant plant ) {
revive();
reset( plant.image );
alpha( 1f );
pos = plant.pos;
x = (pos % Dungeon.level.width()) * DungeonTilemap.SIZE;
y = (pos / Dungeon.level.width()) * DungeonTilemap.SIZE;
state = State.GROWING;
time = DELAY;
}
public void reset( int image ) {
frame( frames.get( image ) );
}
@Override
public void update() {
super.update();
switch (state) {
case GROWING:
if ((time -= Game.elapsed) <= 0) {
state = State.NORMAL;
scale.set( 1 );
} else {
scale.set( 1 - time / DELAY );
}
break;
case WITHERING:
if ((time -= Game.elapsed) <= 0) {
super.kill();
} else {
alpha( time / DELAY );
}
break;
default:
}
}
@Override
public void kill() {
state = State.WITHERING;
time = DELAY;
}
}

View File

@ -1,90 +0,0 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2016 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.sprites;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.DungeonTilemap;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap;
import com.watabou.noosa.Image;
import com.watabou.noosa.TextureFilm;
public class TrapSprite extends Image {
private static TextureFilm frames;
private int pos = -1;
//trap colors
public static final int RED = 0;
public static final int ORANGE = 1;
public static final int YELLOW = 2;
public static final int GREEN = 3;
public static final int TEAL = 4;
public static final int VIOLET = 5;
public static final int WHITE = 6;
public static final int GREY = 7;
public static final int BLACK = 8;
//trap shapes
public static final int DOTS = 0;
public static final int WAVES = 1;
public static final int GRILL = 2;
public static final int STARS = 3;
public static final int DIAMOND = 4;
public static final int CROSSHAIR = 5;
public static final int LARGE_DOT = 6;
public TrapSprite() {
super( Assets.TERRAIN_FEATURES );
if (frames == null) {
frames = new TextureFilm( texture, 16, 16 );
}
origin.set( 8, 12 );
}
public TrapSprite( int image ) {
this();
reset( image );
}
public void reset( Trap trap ) {
revive();
reset( (trap.active ? trap.color : BLACK) + (trap.shape * 16) );
alpha( 1f );
pos = trap.pos;
x = (pos % Dungeon.level.width()) * DungeonTilemap.SIZE;
y = (pos / Dungeon.level.width()) * DungeonTilemap.SIZE;
}
public void reset( int image ) {
frame( frames.get( image ) );
}
}

View File

@ -25,7 +25,6 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap;
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
import com.watabou.noosa.Image;
import com.watabou.noosa.TextureFilm;
import com.watabou.noosa.Tilemap;
@ -33,6 +32,7 @@ import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
import com.watabou.utils.SparseArray;
//TODO add in a proper set of vfx for plants growing/withering, grass burning, discovering traps
public class TerrainFeaturesTilemap extends Tilemap {
public static final int SIZE = 16;
@ -99,7 +99,7 @@ public class TerrainFeaturesTilemap extends Tilemap {
if (!trap.visible)
return -1;
else
return (trap.active ? trap.color : TrapSprite.BLACK) + (trap.shape * 16);
return (trap.active ? trap.color : Trap.BLACK) + (trap.shape * 16);
}
if (plants.get(pos) != null){

View File

@ -21,10 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.PlantSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.TerrainFeaturesTilemap;
public class WndInfoPlant extends WndTitledMessage {