Create BjornInputComponent.java
This commit is contained in:
parent
c28b8edf9e
commit
1fb1073436
@ -0,0 +1,22 @@
|
||||
package com.iluwatar.component;
|
||||
|
||||
/**
|
||||
* BjornInputComponent is a class for our main game star
|
||||
* This class creat a Input component for Bjorn.
|
||||
*/
|
||||
|
||||
public class BjornInputComponent implements InputComponent {
|
||||
|
||||
/**
|
||||
* This method is a logger for Bjorn when happens a Input update.
|
||||
* In real scenario, there will be code for dealing with IO.
|
||||
*
|
||||
* @param gameObject is a object in the game, here it is Bjorn
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void update(GameObject gameObject) {
|
||||
gameObject.setPositionOFx(gameObject.getPositionOFx() + gameObject.getVelocity());
|
||||
gameObject.setPositionOFy(gameObject.getPositionOFy() + gameObject.getVelocity());
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user