Hi Guys,
I am trying to get the mobile joystick to use multiple key bindings and I'm not having much luck so far. Here is what I have- I am modding the SPG_PlayerController from the Platformer Game Starter Kit.
Chained Key Binding
Joystick Input ZoneCode:Bindings=(Name="MOBILE_APlatformY",Command="Axis aUp Speed=-1.0 AbsoluteAxis=100 | Axis aLookup Speed=+1 DeadZone=0.05 | Axis aLookup Speed=-1 DeadZone=0.05 ")
PlayerControllerScriptCode:InputKey=APlatformY HorizontalInputKey=MOBILE_AStrafe Type=ZoneType_Joystick bRelativeX=true bRelativeY=true bRelativeSizeX=true bRelativeSizeY=true X=0.1 Y=-0.3 SizeX=0.15 SizeY=1.0 bSizeYFromSizeX=true VertMultiplier=-1.0 HorizMultiplier=1.0 bScalePawnMovement=true RenderColor=(R=0,G=255,B=69,A=255) InactiveAlpha=0.25 bUseGentleTransitions=true ResetCenterAfterInactivityTime=3.0 ActivateTime=0.6 DeactivateTime=0.2 TapDistanceConstraint=5
Code://============================================================================= // SPG_PlayerController // // Pawn which represents the player. Handles visual components and driving // the aim offset. // // Copyright 1998-2011 Epic Games, Inc. All Rights Reserved. //============================================================================= class SPG_PlayerController extends GamePlayerController; // The desired rotation that we want the pawn to be facing var Rotator DesiredRotation; //Mobile Input Variables var MobileInputZone MainGroup; var MobilePlayerInput myInput; var MobileInputZone Joystick; var bool bDoDeferredTouch; struct TouchHandler { var Actor GrabbedActor; var int TouchHandle; var Vector theDeferredTouchLocation; var bool bNeedDeferredTouchCheck; }; var array<TouchHandler> TouchHandles; var int MaxTouches; event InitInputSystem() { super.InitInputSystem(); `Log("initing system now "$PlayerInput); //SetupZones(); } /** * Updates the rotation of the controller and the pawn. Called once per tick * * @param DeltaTime Time since the last tick was executed. * @network Server and client */ function UpdateRotation(float DeltaTime) { local Rotator DeltaRot; // Set the delta rotation to that of the desired rotation, as the desired rotation represents // the rotation derived from the acceleration of the pawn DeltaRot = DesiredRotation; // Set the delta pitch to read from the look up input DeltaRot.Pitch = PlayerInput.aLookUp; // Never need to roll the delta rotation DeltaRot.Roll = 0; // Shake the camera if necessary ViewShake(DeltaTime); // If we have a pawn, update its facing rotation if (Pawn != None) { Pawn.FaceRotation(DeltaRot, DeltaTime); } } // Default state that pawn is walking state PlayerWalking { /** * Handle player moving. Called once per tick * * @param DeltaTime Time since the last tick * @network Server and client */ function PlayerMove(float DeltaTime) { local Vector X, Y, Z, NewAccel, CameraLocation; local Rotator OldRotation, CameraRotation; local bool bSaveJump; // If we don't have a pawn to control, then we should go to the dead state if (Pawn == None) { GotoState('Dead'); } else { // Grab the camera view point as we want to have movement aligned to the camera PlayerCamera.GetCameraViewPoint(CameraLocation, CameraRotation); // Get the individual axes of the rotation GetAxes(CameraRotation, X, Y, Z); // Update acceleration NewAccel = PlayerInput.aStrafe * Y; NewAccel.Z = 0; NewAccel = Pawn.AccelRate * Normal(NewAccel); // Set the desired rotation DesiredRotation = Rotator(NewAccel); // Update rotation OldRotation = Rotation; UpdateRotation(DeltaTime); // Update crouch if(PlayerInput.aBaseY < 0) { Pawn.ShouldCrouch(bool(bDuck)); } // Handle jumping if (bPressedJump && Pawn.CannotJumpNow()) { bSaveJump = true; bPressedJump = false; } else { bSaveJump = false; } PlayerInput.aForward = 0; //Move based on side-scrolling Pawn.SetRotation(rot(0, -16384, 0)); super.PlayerMove(DeltaTime); // Update the movement, either replicate it or process it if (Role < ROLE_Authority) { ReplicateMove(DeltaTime, NewAccel, DCLICK_None, OldRotation - Rotation); } else { ProcessMove(DeltaTime, NewAccel, DCLICK_None, OldRotation - Rotation); } bPressedJump = bSaveJump; } } } defaultproperties { CameraClass=class'SPG_Camera' InputClass=class'GameFramework.MobilePlayerInput' }



Reply With Quote

Bookmarks