Water level visuals from above water
Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com> Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
2061be33a6
commit
7195cdd139
BIN
maps/world1.map
BIN
maps/world1.map
Binary file not shown.
@ -11,6 +11,8 @@ import sig.engine.Rectangle;
|
|||||||
import sig.engine.Sprite;
|
import sig.engine.Sprite;
|
||||||
import sig.engine.String;
|
import sig.engine.String;
|
||||||
import sig.engine.Transform;
|
import sig.engine.Transform;
|
||||||
|
import sig.map.Map;
|
||||||
|
import sig.objects.LevelRenderer;
|
||||||
|
|
||||||
public class DrawLoop {
|
public class DrawLoop {
|
||||||
public static Panel panel;
|
public static Panel panel;
|
||||||
@ -204,11 +206,13 @@ public class DrawLoop {
|
|||||||
|
|
||||||
|
|
||||||
public static void Draw(byte[] canvas,int index, byte col) {
|
public static void Draw(byte[] canvas,int index, byte col) {
|
||||||
if(RabiClone.player!=null && RabiClone.player.isUnderwater()){
|
int camera_y = (int)RabiClone.level_renderer.getY();
|
||||||
canvas[index]=(byte)((int)(col+33)&0xff);
|
int y = index/RabiClone.BASE_WIDTH;
|
||||||
}
|
if(RabiClone.level_renderer!=null&&y<=RabiClone.CURRENT_MAP.getMap().getWaterLevel()-camera_y){
|
||||||
else{
|
|
||||||
canvas[index]=(byte)((int)(col)&0xff);
|
canvas[index]=(byte)((int)(col)&0xff);
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
canvas[index]=(byte)((int)(col+33)&0xff);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,9 @@ public class LevelRenderer extends Object{
|
|||||||
for (int y=0;y<RabiClone.BASE_HEIGHT;y++) {
|
for (int y=0;y<RabiClone.BASE_HEIGHT;y++) {
|
||||||
for (int x=0;x<RabiClone.BASE_WIDTH;x++) {
|
for (int x=0;x<RabiClone.BASE_WIDTH;x++) {
|
||||||
int index = y*RabiClone.BASE_WIDTH+x;
|
int index = y*RabiClone.BASE_WIDTH+x;
|
||||||
if(RabiClone.player!=null && RabiClone.player.isUnderwater()){
|
int camera_y = (int)RabiClone.level_renderer.getY();
|
||||||
|
int Y = index/RabiClone.BASE_WIDTH;
|
||||||
|
if(!(Y<=RabiClone.CURRENT_MAP.getMap().getWaterLevel()-camera_y)){
|
||||||
p[index] = (byte)(targetBackground.getPixels()[
|
p[index] = (byte)(targetBackground.getPixels()[
|
||||||
((y+(int)(getY()*targetBackground.getScrollSpeed()))%targetBackground.getHeight())*targetBackground.getWidth()+((x+(int)(getX()*targetBackground.getScrollSpeed()))%targetBackground.getWidth())
|
((y+(int)(getY()*targetBackground.getScrollSpeed()))%targetBackground.getHeight())*targetBackground.getWidth()+((x+(int)(getX()*targetBackground.getScrollSpeed()))%targetBackground.getWidth())
|
||||||
]+33);
|
]+33);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user