Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package arm;
- import iron.system.Input;
- import iron.math.Vec4;
- class Character extends iron.Trait {
- public function new() {
- super();
- notifyOnInit(function() {
- //var//
- var key = Input.getKeyboard();
- var mo = Input.getMouse();
- var cam = iron.Scene.active.getCamera("cam");
- //stuff
- var playerViewOffset = 0.6; //The height at which the camera is bound to
- var xMouseSensitivity = 30.0;
- var yMouseSensitivity = 30.0;
- //frame occuring factor
- var gravity = 20.0;
- var friction = 6; //ground friction
- // Movement stuff//
- var moveSpeed = 7.0; // Ground move speed
- var runAcceleration = 14.0; // Ground accel
- var runDeacceleration = 10.0; // Deacceleration that occurs when running on the ground
- var airAcceleration = 2.0; // Air accel
- var airDecceleration = 2.0; // Deacceleration experienced when ooposite strafing
- var airControl = 0.3; // How precise air control is
- var sideStrafeAcceleration = 50.0; // How fast acceleration occurs to get up to sideStrafeSpeed when
- var sideStrafeSpeed = 1.0; // What the max speed to generate when side strafing
- var jumpSpeed = 8.0; // The speed at which the character's up axis gains when hitting jump
- var holdJumpBhop = false; // When enabled allows player to just hold jump button to keep on bhopping perfectly. Beware: smells like casual.
- //FPS stuff//
- var fpsDisplayRate = 4.0;
- var frameCount = 0;
- var dt = 0.0;
- var fps = 0.0;
- //cam rotation
- var rotX = 0.0;
- public var rotY = 0.0;
- var moveDirectionNorm = new Vec4();
- var playerVelocity = new Vec4();
- var playerTopVelocity = 0.0;
- // Q3: players can queue the next jump just before he hits the ground
- var wishJump = false;
- // Used to display real time fricton values
- var playerFriction = 0.0;
- mo.hide();
- mo.lock();
- });
- //notifyOnUpdate(function() {
- //});
- // notifyOnRemove(function() {
- // });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement