Include a water overlay when going underwater

Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com>
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2, Sig, Sigo 2 years ago committed by GitHub
parent 099a19c461
commit 7ec9aefae6
  1. BIN
      RabiClone_0.0a.zip
  2. BIN
      backgrounds/water-overlay.gif
  3. 1
      backgrounds/water-overlay.pixil
  4. BIN
      bin/RabiClone.jar
  5. BIN
      bin/controls.config
  6. 56
      src/sig/engine/Sprite.java
  7. 5
      src/sig/engine/objects/Object.java
  8. 13
      src/sig/objects/LevelRenderer.java

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

@ -9,32 +9,36 @@ import javax.imageio.ImageIO;
public class Sprite{
//NANA(new File(new File("..","sprites"),"3x.png")),
public static Sprite NANA_SMALL = new Sprite(new File(new File("..","sprites"),"1x.gif"));
public static Sprite TILE_SHEET = new Sprite(new File(new File("..","sprites"),"tiles.gif"));
public static Sprite MAP_TILE_INFO = new Sprite(new File(new File("..","sprites"),"maptileinfo.gif"));
public static Sprite PROFONT = new Sprite(new File(new File("..","sprites"),"Profont.gif"));
public static Sprite BACKGROUND1 = new Sprite(new File(new File("..","backgrounds"),"back1.gif"));
public static Sprite BACKGROUND2 = new Sprite(new File(new File("..","backgrounds"),"back2.gif"));
public static Sprite BACKGROUND3 = new Sprite(new File(new File("..","backgrounds"),"back3.gif"));
public static AnimatedSprite ERINOAH = new AnimatedSprite(new File(new File("..","sprites"),"erinoah.gif"),48,48);
public static AnimatedSprite ERINA = new AnimatedSprite(new File(new File("..","sprites"),"erina.gif"),32,32);
public static AnimatedSprite ERINA_WALK = new AnimatedSprite(new File(new File("..","sprites"),"erina_walk.gif"),32,32);
public static AnimatedSprite ERINA_JUMP_RISE1 = new AnimatedSprite(new File(new File("..","sprites"),"erina_jump_rise1.gif"),32,32);
public static AnimatedSprite ERINA_JUMP_RISE = new AnimatedSprite(new File(new File("..","sprites"),"erina_jump_rise.gif"),32,32);
public static AnimatedSprite ERINA_JUMP_FALL1 = new AnimatedSprite(new File(new File("..","sprites"),"erina_jump_fall1.gif"),32,32);
public static AnimatedSprite ERINA_JUMP_FALL = new AnimatedSprite(new File(new File("..","sprites"),"erina_jump_fall.gif"),32,32);
public static AnimatedSprite ERINA_SLIDE1 = new AnimatedSprite(new File(new File("..","sprites"),"erina_slide1.gif"),32,32);
public static AnimatedSprite ERINA_SLIDE = new AnimatedSprite(new File(new File("..","sprites"),"erina_slide.gif"),32,32);
public static AnimatedSprite KNIFE_SWING = new AnimatedSprite(new File(new File("..","sprites"),"knife-swing.gif"),32,32);
public static AnimatedSprite RED_STAND = new AnimatedSprite(new File(new File("..","sprites"),"redgirl_stand.gif"),32,32);
public static AnimatedSprite RED_WALK = new AnimatedSprite(new File(new File("..","sprites"),"redgirl_walk.gif"),32,32);
public static AnimatedSprite BLUE_STAND = new AnimatedSprite(new File(new File("..","sprites"),"bluegirl_stand.gif"),32,32);
public static AnimatedSprite BLUE_WALK = new AnimatedSprite(new File(new File("..","sprites"),"bluegirl_walk.gif"),32,32);
public static AnimatedSprite YELLOW_STAND = new AnimatedSprite(new File(new File("..","sprites"),"yellowgirl_stand.gif"),32,32);
public static AnimatedSprite YELLOW_WALK = new AnimatedSprite(new File(new File("..","sprites"),"yellowgirl_walk.gif"),32,32);
public static AnimatedSprite GREEN_STAND = new AnimatedSprite(new File(new File("..","sprites"),"greengirl_stand.gif"),32,32);
public static AnimatedSprite GREEN_WALK = new AnimatedSprite(new File(new File("..","sprites"),"greengirl_walk.gif"),32,32);
public final static File SPRITES_FOLDER = new File("..","sprites");
public final static File BACKGROUNDS_FOLDER = new File("..","backgrounds");
//NANA(new File(SPRITES_FOLDER,"3x.png")),
public static Sprite NANA_SMALL = new Sprite(new File(SPRITES_FOLDER,"1x.gif"));
public static Sprite TILE_SHEET = new Sprite(new File(SPRITES_FOLDER,"tiles.gif"));
public static Sprite MAP_TILE_INFO = new Sprite(new File(SPRITES_FOLDER,"maptileinfo.gif"));
public static Sprite PROFONT = new Sprite(new File(SPRITES_FOLDER,"Profont.gif"));
public static Sprite BACKGROUND1 = new Sprite(new File(BACKGROUNDS_FOLDER,"back1.gif"));
public static Sprite BACKGROUND2 = new Sprite(new File(BACKGROUNDS_FOLDER,"back2.gif"));
public static Sprite BACKGROUND3 = new Sprite(new File(BACKGROUNDS_FOLDER,"back3.gif"));
public static AnimatedSprite ERINOAH = new AnimatedSprite(new File(SPRITES_FOLDER,"erinoah.gif"),48,48);
public static AnimatedSprite ERINA = new AnimatedSprite(new File(SPRITES_FOLDER,"erina.gif"),32,32);
public static AnimatedSprite ERINA_WALK = new AnimatedSprite(new File(SPRITES_FOLDER,"erina_walk.gif"),32,32);
public static AnimatedSprite ERINA_JUMP_RISE1 = new AnimatedSprite(new File(SPRITES_FOLDER,"erina_jump_rise1.gif"),32,32);
public static AnimatedSprite ERINA_JUMP_RISE = new AnimatedSprite(new File(SPRITES_FOLDER,"erina_jump_rise.gif"),32,32);
public static AnimatedSprite ERINA_JUMP_FALL1 = new AnimatedSprite(new File(SPRITES_FOLDER,"erina_jump_fall1.gif"),32,32);
public static AnimatedSprite ERINA_JUMP_FALL = new AnimatedSprite(new File(SPRITES_FOLDER,"erina_jump_fall.gif"),32,32);
public static AnimatedSprite ERINA_SLIDE1 = new AnimatedSprite(new File(SPRITES_FOLDER,"erina_slide1.gif"),32,32);
public static AnimatedSprite ERINA_SLIDE = new AnimatedSprite(new File(SPRITES_FOLDER,"erina_slide.gif"),32,32);
public static AnimatedSprite KNIFE_SWING = new AnimatedSprite(new File(SPRITES_FOLDER,"knife-swing.gif"),32,32);
public static AnimatedSprite RED_STAND = new AnimatedSprite(new File(SPRITES_FOLDER,"redgirl_stand.gif"),32,32);
public static AnimatedSprite RED_WALK = new AnimatedSprite(new File(SPRITES_FOLDER,"redgirl_walk.gif"),32,32);
public static AnimatedSprite BLUE_STAND = new AnimatedSprite(new File(SPRITES_FOLDER,"bluegirl_stand.gif"),32,32);
public static AnimatedSprite BLUE_WALK = new AnimatedSprite(new File(SPRITES_FOLDER,"bluegirl_walk.gif"),32,32);
public static AnimatedSprite YELLOW_STAND = new AnimatedSprite(new File(SPRITES_FOLDER,"yellowgirl_stand.gif"),32,32);
public static AnimatedSprite YELLOW_WALK = new AnimatedSprite(new File(SPRITES_FOLDER,"yellowgirl_walk.gif"),32,32);
public static AnimatedSprite GREEN_STAND = new AnimatedSprite(new File(SPRITES_FOLDER,"greengirl_stand.gif"),32,32);
public static AnimatedSprite GREEN_WALK = new AnimatedSprite(new File(SPRITES_FOLDER,"greengirl_walk.gif"),32,32);
public static Sprite WATER_OVERLAY = new Sprite(new File(BACKGROUNDS_FOLDER,"water-overlay.gif"));

@ -2,6 +2,7 @@ package sig.engine.objects;
import java.awt.event.MouseEvent;
import sig.DrawLoop;
import sig.RabiClone;
import sig.engine.Action;
import sig.engine.Alpha;
import sig.engine.AnimatedSprite;
@ -132,6 +133,10 @@ public abstract class Object implements GameEntity{
public void MouseReleased(MouseEvent e) {
}
public boolean isUnderwater() {
return getY()>=RabiClone.CURRENT_MAP.getMap().getWaterLevel();
}
protected boolean MouseHeld(int mb) {
return panel.MOUSE.getOrDefault(mb,false);
}

@ -117,8 +117,17 @@ public class LevelRenderer extends Object{
@Override
public void drawOverlay(byte[] p) {
//RenderCollisionGrid(p);
//RenderPlayerCollisionGrid(p);
if (RabiClone.player!=null&&RabiClone.player.isUnderwater()) {
for (int y=0;y<RabiClone.BASE_HEIGHT;y++) {
for (int x=0;x<RabiClone.BASE_WIDTH;x++) {
//Draw the water background at double size because it's half the screen's width and height.
int index = y*RabiClone.BASE_WIDTH+x;
p[index] = Sprite.WATER_OVERLAY.getBi_array()[
((y/2)*Sprite.WATER_OVERLAY.getCanvasHeight())*Sprite.WATER_OVERLAY.getCanvasWidth()+(x/2)*Sprite.WATER_OVERLAY.getCanvasWidth()
];
}
}
}
}
@SuppressWarnings("unused")

Loading…
Cancel
Save