12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- package me.hammerle.supersnuvi.entity.components.ai;
- import me.hammerle.supersnuvi.entity.Entity;
- import me.hammerle.supersnuvi.gamelogic.Level;
- import me.hammerle.supersnuvi.tiles.RampTile;
- import me.hammerle.supersnuvi.tiles.Tile;
- import me.hammerle.supersnuvi.util.Face;
- public class StartScreenHeroController extends HumanController
- {
- private boolean shouldJump = false;
-
- @Override
- public void tick(Entity ent, Level level)
- {
- ent.applyOwnForce(ent.getMovement().getVelocityX(), 0.0f);
-
- if(shouldJump)
- {
- shouldJump = false;
- ent.jump();
- }
-
- ox = 0.0f;
- oy = 0.0f;
- h = 2.0f;
- w = 1.0f;
-
- if(ent.isOnGround())
- {
- if(ent.getOwnForceX() == 0.0f)
- {
- tx = (idleFrame * 32.0f) / SIZE;
- ty = 128.0f / SIZE;
- nextIdleFrame();
- }
- else
- {
- tx = (96.0f + walkFrame * 32.0f) / SIZE;
- ty = 0.0f;
- nextWalkFrame();
- }
- }
- else
- {
- resetFrames();
- tx = 0.0f;
- ty = 0.0f;
- }
- }
- @Override
- public void onCollideWithTile(Entity ent, int x, int y, Level l, Tile t, Face face)
- {
- if(face == Face.RIGHT && !(t instanceof RampTile))
- {
- shouldJump = true;
- }
- }
- }
|