playMaker

Author Topic: less than greater than  (Read 8098 times)

gamedivision

  • Full Member
  • ***
  • Posts: 227
less than greater than
« on: February 17, 2013, 08:28:43 AM »
do we have anything in the form of if less than but greater than do this or do that event

thank you

kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: less than greater than
« Reply #1 on: February 17, 2013, 09:03:31 AM »
Hey,
let's say  we want to check if something is smaller than 10, but bigger than three:
Then we first use a float compare which checks if the float is bigger than 3. If it is smaller, this action sends the FAIL event. If it is bigger, it sends nothing.
Then in the same state we add another float compare action (after the previous one). This action now compares if the float is smaller than 10. If it is, it sends the event FINISHED. If it isn't, it sends FAIL.

So what we end up is a state that sends FAIL if either of the 2 conditions is not met. It sends FINISHED if both are true.
Best,
Sven

gamedivision

  • Full Member
  • ***
  • Posts: 227
Re: less than greater than
« Reply #2 on: February 17, 2013, 09:48:02 AM »
ahh so it doesn't pass to the next float compare unless it satisfies the first

kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: less than greater than
« Reply #3 on: February 17, 2013, 09:56:39 AM »
yep, states are processed top to bottom :) It allows for a number of awesome techniques  ;)
Best,
Sven

will_brett

  • Junior Playmaker
  • **
  • Posts: 72
Re: less than greater than
« Reply #4 on: February 17, 2013, 01:22:41 PM »
This video explains something very similar really well.


gamedivision

  • Full Member
  • ***
  • Posts: 227
Re: less than greater than
« Reply #5 on: February 17, 2013, 04:15:29 PM »
thanks for the replies,it seems everything i do so far doesn't work , i have to compare 3 different positions using swipe up and swipe down,swipe up needs to check if its below a certain point then it can move to either middle or top and swipe down needs to check whether it can move middle or bottom,now with your theory kiriri because it processes from top the most you could ever put in my situation would be 2 compares,so it will never process whether it needs to move to the middle or not. im stuck completely thats why i wanted to use itween move add because i could compare the position and move by 5 or whatever then i would get my positions but it just doesnt want to move to exact numbers,same with all the move actions none are exact .

gamedivision

  • Full Member
  • ***
  • Posts: 227
Re: less than greater than
« Reply #6 on: February 18, 2013, 07:05:30 AM »
I wonder if I can solve this via booleans ,or I'm wondering if I could cycle through game objects using get child,I could position empty game objects around my box front rear middle left and right,make child objects of the the front object.then on the box use a get poisition and store the z value which is moving forward in a float,then use a set position on the front empty game object,and set the z position so the left and right empty game objects stay in the same position when I move, therefore I could use those left and right game objects as positions to move to when I swipe.
So I could store those and use I think.

kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: less than greater than
« Reply #7 on: February 18, 2013, 10:35:03 AM »
Hey can you describe you're problem a bit further? I'm sure there is a simple solution, there always is, but I don't seem to grasp your setup  :-\
Best,
Sven

gamedivision

  • Full Member
  • ***
  • Posts: 227
Re: less than greater than
« Reply #8 on: February 18, 2013, 10:55:58 AM »
Sorry I tend to over complicate things.
Image a box moving continuously in one direction say down the Z axis,when I swipe up the box moves left on X axis,when I swipe down the box moves right X axis,but only in three locations middle 0,left 5,right -5 depending on the scale and position.
Hopefully that's made it easier to understand

Thanks for the reply  ;D

kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: less than greater than
« Reply #9 on: February 18, 2013, 11:26:59 AM »
I too am most horrible at explaning my problems to others , which is why I seem like I know it all :D
ok, let's see if I got you.

The game starts and we see a cube that is slowly moving (translate every frame per second) from the top of the screen to the bottom.
Now the player can touch anywhere on the screen and quickly move his finger to initiate a "swipe" . Depending of the start - end position of the swipe (the direction) it will be counted as swipe left, right, up or down.

And here's where I'm getting less certain:

If the player does a swipe left, it should start moving the cube on the negative x direction (as well as still continuing on the z axis) ? Continuously or does it only move shortly (like with a rigidbody force) ?

Then it should move until the x position is either 0, -5 or 5 ?

Dense me  ;D
Best,
Sven

gamedivision

  • Full Member
  • ***
  • Posts: 227
Re: less than greater than
« Reply #10 on: February 18, 2013, 12:43:15 PM »
the swipe will be up to move left and down to move right

gamedivision

  • Full Member
  • ***
  • Posts: 227
Re: less than greater than
« Reply #11 on: February 18, 2013, 12:44:58 PM »
zero would be the middle then plus 5 minus 5 so three positions to move in

kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: less than greater than
« Reply #12 on: February 18, 2013, 01:01:19 PM »
so maybe you need "clamp float" ?
If you get the current x position every frame, clamp it to -5 to 5 every frame and then set the position to that value every frame, it will be restricted to -5 to 5 as long as the state runs.

Was that it?
Best,
Sven

gamedivision

  • Full Member
  • ***
  • Posts: 227
Re: less than greater than
« Reply #13 on: February 18, 2013, 02:00:08 PM »
ill post a picture which will better explain

gamedivision

  • Full Member
  • ***
  • Posts: 227
Re: less than greater than
« Reply #14 on: February 18, 2013, 02:17:39 PM »

i hope this better demonstrates my scenario,as you can see the box can move to either of those 3 positions using a swipe to move,remembering that the box will be moving forward all the time.
« Last Edit: February 18, 2013, 02:21:27 PM by gamedivision »