123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- package me.hammerle.supersnuvi.entity.components.ai;
- import me.hammerle.supersnuvi.entity.Entity;
- import me.hammerle.supersnuvi.tiles.Location;
- 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;
-
- public StartScreenHeroController(Entity ent)
- {
- super(ent);
- }
-
- @Override
- public void tick()
- {
- ent.setMotionX(ent.getMovement().getVelocityX());
-
- if(shouldJump)
- {
- shouldJump = false;
- ent.getMovement().jump();
- }
-
- ox = ent.getFace() == Face.RIGHT ? 0.0f : -0.15625f * Tile.SIZE;
- oy = 0.0f;
- h = 2.0f;
- w = 1.0f;
-
- if(ent.isOnGround())
- {
- if(ent.getMotionX() == 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(Location loc, Face face)
- {
- if(face == Face.RIGHT && !(loc.getTile() instanceof RampTile))
- {
- shouldJump = true;
- }
- }
- }
|