playMaker

Author Topic: Camera zoom  (Read 2173 times)

fabmagic

  • Playmaker Newbie
  • *
  • Posts: 5
Camera zoom
« on: June 10, 2012, 11:59:33 AM »
Im doing a game like tiny wings
I created a few hills
I got the camera to follow my player
Now I want to be able to zoom out the camera when my player jumps high to see more landing area
Maybe an if statement that if the player is a certain distance from the ground then the camera moves back?
How do I do the if statement in playmaker if that's the case
Please help
Thanks
Fab

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Camera zoom
« Reply #1 on: June 10, 2012, 01:27:52 PM »
Hi,


 One way to do it very easily. Have a collider at the height you want to zoom out, and when the player trigger that collider, you then fire an event to the camery fsm to tell it to zoom out, and you can then call the camer again to zoom back in when the player touches the ground again.

As for doing If statements, playmaker gives you actually a lot more power than if statements- this concept by simply completly absorbed by the event based concept of Fsm. So to do one:

 1: create pair events like "YES" "NO" or "TRUE" "FALSE".Dont' make them global, that would not make sense.
2: in a state, add them two transitions, and use actions such as:

"float sign test"
"float compare"
"int compare"
and all them kind of actions where you can fire events based on some logic.

3: wire from the transitions to states that correspond to the action(s) to perform (  IF YES DO THAT, IF NO DO THIS)

Note, that in a lot of cases, you could simply express in plain english the process by naming events properly. for example, "ZOOM OUT" and "ZOOM IN" and name your state "Watch player height". This way as you glance through your fsm, it's very obvious what it does. You could get confused when too much "YES" "NO" are on screen, it can be difficult to follow the process, tho if you name your states properly, you'll be fine.

Bye,

 Jean