playMaker

Author Topic: Float Clamp Translate  (Read 1247 times)

LuminRabbit

  • Full Member
  • ***
  • Posts: 161
  • Lumin Rabbit
Float Clamp Translate
« on: June 19, 2020, 08:16:24 PM »

I have a basic cube that moves -1 (each time the mouse is clicked) in the X direction using translate. I want to limit this movement so that it cannot travel further than -3 in the X. I'm missing how to tie the two together using Float Clamp, here is how I have the states setup so far:

State 1:
Get Button Down= Fire 1, Send Event= Move
Get Position: X = thisX
Float Clamp: Float Var = thisX, Min = -3, Max = 3

State 2:
Translate: Game Object = Use Owner, X = -1, unchecked per second and every frame.

I can see that in State 1, Get Position is clamped to the float clamp value which is awesome but how would I clamp the translate movement as well?
Have I said how much I love playmaker!!! This is one amazing tool

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Float Clamp Translate
« Reply #1 on: June 20, 2020, 01:28:12 PM »
Hi.
maybe you can check before moving the cube.
something like :

Get Position, then add or deduct 1 from that position.(depending on the direction)
Then do float compare and if its out of bounds cancel the move.

You can even add a sound or color change or something to notice the player that you can't do that.
But that depends of your game of course.

LuminRabbit

  • Full Member
  • ***
  • Posts: 161
  • Lumin Rabbit
Re: Float Clamp Translate
« Reply #2 on: June 20, 2020, 04:30:58 PM »
I'll give it a try, sounds like it should definitely work, be back soon :)
Thank You!
Have I said how much I love playmaker!!! This is one amazing tool