playMaker

Author Topic: (SOLVED) Playmaker SHMUP Mousedrag  (Read 2160 times)

Mornar

  • Playmaker Newbie
  • *
  • Posts: 40
    • View Profile
(SOLVED) Playmaker SHMUP Mousedrag
« on: September 29, 2014, 04:16:14 AM »
Hi

I was looking for a FSM to move my Spaceship when dragged with a mouse.
I don't know how to drag my ship when left mousebutton is clicked.

I've tried a lot of possibilities but i think some of you guys can help me.

Thanks alot

Mornar
« Last Edit: October 04, 2014, 03:36:27 AM by Mornar »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: Playmaker SHMUP Mousedrag
« Reply #1 on: September 29, 2014, 04:19:07 AM »
Do you have an example of the control scheme you're going for?

Mornar

  • Playmaker Newbie
  • *
  • Posts: 40
    • View Profile
Re: Playmaker SHMUP Mousedrag
« Reply #2 on: September 29, 2014, 04:53:11 AM »
Sry my englisch is not the best.
But if I get it right I think you need an explaination what i am looking for.

1. The ship is waiting.
2. When i hold the left mouse button on the ship i should be able to move it over the screen.
3. If I release the ship should stay at the position till i drag it again.

The screen is like the portrait of a mobile screen 1080 width and 1920 hight.
I was was able to get it right on a mobile device but i have trouble to get it for mouse control.

does that help?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: Playmaker SHMUP Mousedrag
« Reply #3 on: September 29, 2014, 05:21:30 AM »
Mouse inputs are very similar to touch inputs, if you've already got it working on mobile with touch then you should check out the actions available for the Mouse and it should be a pretty straightforward change.

Mornar

  • Playmaker Newbie
  • *
  • Posts: 40
    • View Profile
Re: Playmaker SHMUP Mousedrag
« Reply #4 on: September 29, 2014, 05:28:06 AM »
I've been trying this for days and days but dont get the results i need.

Is it possible for you or anybody else to show me a step by step way or a screenshot of your idea how it could work.
I would apreciate that a lot :)

Because I am really struggeling to get this done. I think something fundamental of my way is wrong.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: Playmaker SHMUP Mousedrag
« Reply #5 on: September 29, 2014, 05:34:15 AM »
Have you tried using a Get Mouse Button Down action to transition into a state where your movement is enabled, then use Get Mouse Button Up to transition out of the state when the button is released, disabling movement?

Mornar

  • Playmaker Newbie
  • *
  • Posts: 40
    • View Profile
Re: Playmaker SHMUP Mousedrag
« Reply #6 on: September 29, 2014, 05:40:54 AM »
Off Course. This was the first thing I have done. But the movement does not work.

I've tried to store the Float from Get Mouse X and Get Mouse Y , multiplied it with the screen ratio. But when i move the mouse the ship only moves a little bit but i want that i can drag it always on the exact posistion of the mousecursor until i release the mouse button.


Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: Playmaker SHMUP Mousedrag
« Reply #7 on: September 29, 2014, 05:44:47 AM »
How about using a Mouse Pick on the floor plane, then move towards the position?

Mornar

  • Playmaker Newbie
  • *
  • Posts: 40
    • View Profile
Re: Playmaker SHMUP Mousedrag
« Reply #8 on: September 29, 2014, 05:49:29 AM »
I already have this function for a dodgeroll. So the ship can escape in difficult situations. When the mouse is released the ship stays in position until i click somewhere on the screen or doubleclick on the screen. So the ship moves to this clicked position.

So the only thing a I need is when mousedown the ship has to be moved by the mouse.

If you remember the game FatCat. So the small owl cann drag the fat cat around?
Something like this.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: Playmaker SHMUP Mousedrag
« Reply #9 on: September 29, 2014, 07:03:23 AM »
Ah ok.

Use Transform Input To World Space.

You'll need Get Axis, separate the X and Y into floats, Transform Input To World Space (save this result as the offset), then add the offset from the character position and save that as your destination for the Move Towards action.
« Last Edit: September 29, 2014, 07:06:44 AM by Lane »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: Playmaker SHMUP Mousedrag
« Reply #10 on: September 29, 2014, 07:05:43 AM »
If it wasn't clear here is a pic of how it works. Get position of the character everyFrame.

Mornar

  • Playmaker Newbie
  • *
  • Posts: 40
    • View Profile
Re: Playmaker SHMUP Mousedrag
« Reply #11 on: September 29, 2014, 07:18:11 AM »
Hey Thanks ... i will try this tonight and tell you if I get it ^^

Mornar

  • Playmaker Newbie
  • *
  • Posts: 40
    • View Profile
Re: Playmaker SHMUP Mousedrag
« Reply #12 on: September 29, 2014, 12:04:35 PM »
Ok I tried it by myself. But.
Can you show me the complete FSM. I know its maybe a bit much but youre help is really important and I'm close to get it right.

First question. Do you put this fsm on the dragable object or an emptyobject?
And at TRANSFORM INPUT TO WORLD SPACE ist there really XZ map to plane?

Would be really great if you can explain it in more detail.

Thank you so much

Mornar

  • Playmaker Newbie
  • *
  • Posts: 40
    • View Profile
Re: Playmaker SHMUP Mousedrag
« Reply #13 on: September 29, 2014, 12:23:17 PM »
Stop i got it^^
Thanks alot. Extremly Helfpul.


Mornar

  • Playmaker Newbie
  • *
  • Posts: 40
    • View Profile
Re: Playmaker SHMUP Mousedrag
« Reply #14 on: September 29, 2014, 12:30:08 PM »
Its still no exactly on the mouse position but i seems to work.