Author Topic: Permanent Button-Action  (Read 20029 times)

BehindTheStone

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 135
    • View Profile
Re: Permanent Button-Action
« Reply #15 on: January 10, 2013, 10:10:06 AM »
Touché! :D

In the scene will be some Enemies, but the game's physics aren't "realistic" and it's way not physic-heavy like other games, so i think that should work quite well.

Well, thank you Cripple! :D

Cripple

  • TNP Alpha
  • Full Member
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 117
    • View Profile
Re: Permanent Button-Action
« Reply #16 on: January 10, 2013, 10:15:11 AM »
I checked the farseer plugin and yeah you should be able to change it in the normal update.

Are you sure than you don't touch the velocity in another script ?
Graphicstream Dev.

BehindTheStone

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 135
    • View Profile
Re: Permanent Button-Action
« Reply #17 on: January 10, 2013, 10:20:46 AM »
Well yes, there are only 2 scripts which influence the Velocity (and one is only for testing things out), so i make sure that only one script is a component.

BehindTheStone

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 135
    • View Profile
Re: Permanent Button-Action
« Reply #18 on: January 10, 2013, 11:03:33 AM »
Hm. Now you mentioned it, it comes to my mind:

i have three different Movement-Buttons (Left, Right, Jump). I copy&pasted the code in order to make a seperate MoveLeft-Scipt and changed the variables (in order to make him move left actually :D ) and another to make him jump.

They have all the same structure.

  1. void Start ()
  2.         {
  3.                 knightObject = GameObject.FindGameObjectWithTag("Player");
  4.  
  5.                
  6.                
  7.                 KnightShape = knightObject.GetComponent<FSBodyComponent>().PhysicsBody;
  8.                 KnightShape.FixedRotation = true;
  9.                
  10.                 velocity = KnightShape.LinearVelocity;
  11.                 m_normal = new FVector2(1,0);
  12.                
  13.                 buttonDown = false;
  14.                
  15.        
  16.         }

And in OnPress(bool isDown) I check if it is pressed and set the buttonDown Variable to "true" so Update() can does its job.

Could that cause any problems? I tested it in the editor and the device and i didn't get strange behaviour (yet... :D ).