still wrong commit -.-

master
GammelJAN 5 years ago
parent 7fd5cd0c87
commit 77103858cd

@ -13,11 +13,11 @@ import com.badlogic.gdx.scenes.scene2d.Actor;
*
* @author Jan
*/
public class MapObject extends Actor{
public class MapCollisionObject extends Actor{
Rectangle r;
public MapObject(int x, int y, int width, int height){
public MapCollisionObject(int x, int y, int width, int height){
setName("mapobject");
r = new Rectangle(x, y, width, height);
setBounds(x, y, width, height);

@ -25,6 +25,7 @@ public class Player extends Actor{
private AnimatedSprite playerSprite;
float movementX = 0;
float movementY = 0;
float speed = 2f;
public Player(int xPos, int yPos){
@ -46,7 +47,7 @@ public class Player extends Actor{
@Override
public void act(float delta) {
if(Gdx.input.isKeyPressed(Input.Keys.D)){
movementX = speed;
}
if(Gdx.input.isKeyPressed(Input.Keys.A)){
setX(getX()-5);

@ -50,7 +50,7 @@ public class GameScreen extends AbstractScreen{
for(MapObject object : map.getLayers().get(2).getObjects().getByType(RectangleMapObject.class)){
Rectangle rect = ((RectangleMapObject) object).getRectangle();
stage.addActor(new com.trs.main.MapObject((int)rect.getX(), (int)rect.getY(), (int)rect.getWidth(), (int)rect.getHeight()));
stage.addActor(new com.trs.main.MapCollisionObject((int)rect.getX(), (int)rect.getY(), (int)rect.getWidth(), (int)rect.getHeight()));
}
}

Loading…
Cancel
Save