Nana can fly

Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com>
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
unknown 3 years ago
parent 0cf0268351
commit a2b0648074
  1. 3
      src/sig/RabiClone.java
  2. 1
      src/sig/objects/LevelRenderer.java
  3. 9
      src/sig/objects/Player.java

@ -29,6 +29,7 @@ public class RabiClone{
public static Point MOUSE_POS;
public static LevelRenderer level_renderer;
public static Player player;
public static Maps CURRENT_MAP = Maps.WORLD1;
public static void main(String[] args) {
@ -51,7 +52,7 @@ public class RabiClone{
f.setVisible(true);
OBJ.add(level_renderer = new LevelRenderer(p));
OBJ.add(new Player(p));
OBJ.add(player = new Player(p));
p.render();

@ -45,6 +45,7 @@ public class LevelRenderer extends Object{
Map.SaveMap(RabiClone.CURRENT_MAP);
System.out.println("Map saved");
}
setY(RabiClone.player.getY());
}
@Override

@ -6,6 +6,10 @@ import sig.engine.Panel;
import sig.engine.Sprite;
public class Player extends Object{
double y_acceleration = 20;
double x_acceleration = 0;
double x_velocity = 0;
double y_velocity = -4;
public Player(Panel panel) {
super(panel);
@ -17,11 +21,14 @@ public class Player extends Object{
@Override
public void update(double updateMult) {
y_velocity += y_acceleration*updateMult;
double displacement = y_velocity*updateMult;
this.setY(this.getY()+displacement);
}
@Override
public void draw(int[] p) {
Draw_Sprite(this.getX(), this.getY(), this.getSprite());
Draw_Sprite(RabiClone.BASE_WIDTH/2-getSprite().getWidth()/2,RabiClone.BASE_HEIGHT*(2/3d)-getSprite().getHeight()/2, this.getSprite());
}
}

Loading…
Cancel
Save