diff --git a/res/tileset.txt b/res/tileset.txt index 7806d62..a6ac5af 100644 --- a/res/tileset.txt +++ b/res/tileset.txt @@ -55,6 +55,7 @@ # - ondeath: - Executes when the player dies on the tile # - onentry: - Executes when the player touches the tile # - onexit: - Executes when the player leaves +# - ontouch: - Executes while the player is in the tile # # [commands] config: # @@ -89,7 +90,7 @@ S null spawn replace=tiles/dirt D tiles/dirt event={onmove:a} . tiles/water speed=0.2 nojump -L tiles/lava fluid nojump dangerous default animation={500,tiles/lava,tiles/lava2,tiles/lava3,tiles/lava4} +L tiles/lava fluid nojump default event={ontouch:lava,ondeath:lavadie} animation={500,tiles/lava,tiles/lava2,tiles/lava3,tiles/lava4} dangerous C tiles/dirt checkpoint _ tiles/ice speed=0.4 acceleration=0.0008 nojump slippery particle={color:#A1CAFF,count:1,iteration:35,lifetime:400,front:true,xacceleration:[-0.02|0.02],yacceleration:[-0.02|0.02]} G tiles/gravel acceleration=0.1 speed=0.5 event={onmove:c} @@ -115,7 +116,7 @@ R tiles/dirt speed=0.5 filter=0 a ( particle={color:#D2691E,count:1,iteration:25,lifetime:500,front:false}; - particle={color:#5B2D00,count:1,iteration:25,lifetime:500,xacceleration:[-0.001|0.001],yacceleration:[-0.001|0.001],front:false} + particle={color:#5B2D00,count:1,iteration:25,lifetime:500,front:false} ) b ( @@ -123,8 +124,20 @@ b ( sound=derp; ) +lava ( + particle={color:#FFFF00,lifetime:200,count:5,iteration:25,xacceleration:[-0.075|0.075],yacceleration:-0.05}; + particle={color:#FFA500,lifetime:200,count:5,iteration:25,xacceleration:[-0.075|0.075],yacceleration:-0.05}; + particle={color:#F3F315,lifetime:100,count:5,iteration:25,xacceleration:[-0.01|0.01],yacceleration:-0.01,front:true}; +) + +lavadie ( + particle={color:#FFFF00,lifetime:200,count:25,iteration:1,xacceleration:[-0.075|0.075],yacceleration:-0.05}; + particle={color:#FFA500,lifetime:200,count:25,iteration:1,xacceleration:[-0.075|0.075],yacceleration:-0.05}; + particle={color:#F3F315,lifetime:100,count:20,iteration:1,xacceleration:[-0.01|0.01],yacceleration:-0.01,front:true}; +) + c ( - particle={color:#A9A9A9,count:5,front:false,iteration:35,lifetime:800,xacceleration:[-0.001|0.001],yacceleration:[-0.001|0.001]}; + particle={color:#A9A9A9,count:5,front:false,iteration:35,lifetime:800}; ) [entities] diff --git a/src/game/Game.java b/src/game/Game.java index d791149..08f7bbd 100644 --- a/src/game/Game.java +++ b/src/game/Game.java @@ -348,6 +348,8 @@ public void run() { // tick the game dev off ;) tick(); + dispatchEvent("ontouch"); + // do particle stuff, and calculate speed new Thread(new Runnable() {@Override public void run() { BufferedImage particles_front = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); @@ -547,6 +549,7 @@ else if(yacceleration < -speed) System.out.println("null!\nnull!\nnull!\nnull!\nnull!\nnull!\nnull!\nA severe error occured."); System.exit(1); } + updateImage(); threadlocked = false; } else @@ -617,10 +620,11 @@ public void kill() { // reset and particles around player public void respawn() { - reset(); // Game game, double x, double y, Color color, int lifetime, int number + reset(); dispatchEvent("ondeath"); + java.util.List particles = Particle.randomlySpread(this, x + half, y + half, Color.GREEN, 600, 100); for(Particle particle : particles) { @@ -630,7 +634,7 @@ public void respawn() { particle.color = new Color(r, g, b); particle.xacceleration = (Math.random() - 0.5) / 3; particle.yacceleration = (Math.random() - 0.5) / 3; - particle.lifetime = (int)(Math.random() * 150); + particle.lifetime = (int)(Math.random() * (Math.random() * (Math.random() * 600))); particle.front = random.nextBoolean(); this.particles.add(particle);