playMaker

Author Topic: Screen Boundaries and Camera Movement  (Read 3691 times)

Mornar

  • Playmaker Newbie
  • *
  • Posts: 40
Screen Boundaries and Camera Movement
« on: October 06, 2014, 05:29:31 AM »
Hi

First of all. Thanks for helping me with my last problem. Everything is working fine now.

Now I've git two more question. Couldn't be that hard but I am still making some mistakes with the variables sometimes.

1: Its a 2,5d Shmup and my Character can move in X and Y axis. What I want is that the character could not leave the screen on Y axis but on the X.

Because its a mobile game in Portrait 1080width x 1920height. But i want bigger maps on the X axis.

AND

2: How can I make the camera moving with the ship if it is leaving the screen on X axis.

I hope you understand my problem and Knows a simple solution.
And finally sorry for my bad english^^


Mornar

  • Playmaker Newbie
  • *
  • Posts: 40
Re: Screen Boundaries and Camera Movement
« Reply #1 on: October 07, 2014, 05:04:00 AM »
Is there anybody who can help me.

If you need more information about the controls or  something just tell me i f that matters.
Becaus I move my character with itween move to and stuff like that.
I read that many people have collision problems.

Is there any way to solve this problem?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Screen Boundaries and Camera Movement
« Reply #2 on: October 08, 2014, 01:32:17 PM »
You could use a trigger at the edge of the screen that clamps the input axis min/max depending on which direction he's going.

For example you have Get Axis storing an inputVariable, then Translate or something using that to move the ship. If moving the ship upwards turns the inputVariable into 1.0 then just clamp it from -1.0 to 0.0 before it is translated and it will never over go upwards.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Mornar

  • Playmaker Newbie
  • *
  • Posts: 40
Re: Screen Boundaries and Camera Movement
« Reply #3 on: October 08, 2014, 03:22:05 PM »
Yeah thats the way I tried this.
If you remember you helped me with my mouse controls.
How can I implement the min and max.

I tried it this way but the ship dont stops.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Screen Boundaries and Camera Movement
« Reply #4 on: October 08, 2014, 03:27:18 PM »
Are you sure the clamp is taking place after the get axis and before the translate?
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Mornar

  • Playmaker Newbie
  • *
  • Posts: 40
Re: Screen Boundaries and Camera Movement
« Reply #5 on: October 08, 2014, 03:36:03 PM »
Hm. Can you show me a picture ? Im not sure if I understand what you mean.

I have an FSM which moves the ship the way you showed me the last time an it works fine.
And i have another which works at the same time. This moves the ship with a mpuse pick.

So and you say. I should put a border (some cubes) arround the screen and make them a trigger right?

Where should i put the FSM which limits the inputX and inputY variables?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Screen Boundaries and Camera Movement
« Reply #6 on: October 08, 2014, 03:51:28 PM »
Ahh right, with the drag style input. It should still work if you clamp it.

If you did it this way, you would add a Float Clamp on the axis you want to clamp, just after you Get Axis, use Float Clamp on the result. Float Clamp would come from a variable, when the character gets to the edge of the screen have a trigger send a change to that variable that Float Clamp is using, also revert it when they exit the trigger.

The order of actions is what is important in the movement FSM, it needs to get the raw input information and store it, then you have to clamp it to something else. So if the player hits the edge of the screen the clamp number changes. If you aren't at the edge of the screen then it would just be something like -50.0 to 50.0 so it isn't clamping anything, but once the trigger hits and it changes the clamp value in the Movement FSM it will be -1.0 to 0.0 which would change the input value and stop the ship from moving in some direction.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Mornar

  • Playmaker Newbie
  • *
  • Posts: 40
Re: Screen Boundaries and Camera Movement
« Reply #7 on: October 08, 2014, 06:10:18 PM »
Ok thanks alot. I will try that.

Mornar

  • Playmaker Newbie
  • *
  • Posts: 40
Re: Screen Boundaries and Camera Movement
« Reply #8 on: October 09, 2014, 06:39:21 PM »
Hm
I tried it this way but i got the same result as I tried i by myself. The ship is  noch standing still.

Cann sou show me a picture from the state where you clamp after the get axis and a picture from the trigger fsm? Would be very helpuful.

Greez

Mornar

  • Playmaker Newbie
  • *
  • Posts: 40
Re: Screen Boundaries and Camera Movement
« Reply #9 on: October 09, 2014, 06:42:55 PM »
I also think that if this works with the mouse drag. It would not work with my pick mouse movement. Except there is a way to limit the movementin any way.

Fot his I am using the method from the tutorials. So ther is a vector called hitpoint. Can I also limit this in some way?
« Last Edit: October 09, 2014, 06:54:54 PM by Mornar »