Newer
Older
JumpingGame / src / main / java / models / JumpGameModel.java
package models;

import entities.*;
import entities.player.*;

import java.util.ArrayList;

//---------------------------------------------------------------
//
public class JumpGameModel implements IModel {
    //---------------------------------------------------------------
    //
    private Acceleration acceleration;
    private Force force;
    private Mass mass;
    private Move move;
    private Position position;
    private Velocity velocity;
    private Onground onground;

    //---------------------------------------------------------------
    private Time time;
    private Gameover gameover;
    private Clear clear;

    //---------------------------------------------------------------
    private Ground ground;

    //---------------------------------------------------------------
    private double jumpPower = 32;
    private ArrayList<Integer> flagTimings = new ArrayList<>(); // フラグ切り替え

    //---------------------------------------------------------------
    //---------------------------------------------------------------
    //
    public JumpGameModel() {
        ground = new Ground();
        position = new Position(new Pair<>(640d, 480d), ground);
        onground = new Onground(ground, position);
        velocity = new Velocity(position, onground);
        acceleration = new Acceleration(velocity, onground);
        force = new Force(acceleration);
        mass = new Mass(acceleration);
        move = new Move(velocity);
        time = new Time();
        gameover = new Gameover(position);
        clear = new Clear(position);
    }

    //---------------------------------------------------------------
    //---------------------------------------------------------------
    // getter
    public Position getPosition() {
        return position;
    }

    public Ground getGround() {
        return ground;
    }

    //---------------------------------------------------------------
    //---------------------------------------------------------------
    //
    public void jump() {
        this.move.moveY(jumpPower);
    }

    //---------------------------------------------------------------
    //
    public void updateGravity(double gravity) {
        this.time.gravity(gravity);
        this.force.gravity(gravity);
        System.out.println("swapWindow Gravity");
    }

    //---------------------------------------------------------------
}