playMaker

Author Topic: How do I create a sprite where my mouse clicks?  (Read 1598 times)

Yonkers

  • Playmaker Newbie
  • *
  • Posts: 6
How do I create a sprite where my mouse clicks?
« on: February 11, 2018, 08:20:50 AM »
I can't figure out how to create an image/sprite where my mouse clicks? I made a state where when you press down it creates an object (The sprite I want to show up)
Then I created a get mouse y and x to get the variables of my mouse but I can't see how to plug the variables into the create object. Its just spawning in the middle of the screen

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: How do I create a sprite where my mouse clicks?
« Reply #1 on: February 12, 2018, 06:08:08 AM »
Hi.
You can use "Set Vector 3 XYZ" and use that variable in the Create object position.

Yonkers

  • Playmaker Newbie
  • *
  • Posts: 6
Re: How do I create a sprite where my mouse clicks?
« Reply #2 on: February 12, 2018, 06:54:53 AM »
Hi.
You can use "Set Vector 3 XYZ" and use that variable in the Create object position.

I did that but its just spawning in the middle.

https://i.imgur.com/jE6OV8D.jpg

Did I set the variables correctly?

What im trying to do is if you press the background it creates a crack graphic, but I want it to be cracked in the place you're pressing.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: How do I create a sprite where my mouse clicks?
« Reply #3 on: February 12, 2018, 07:20:19 AM »
Hi,
if you check "Debug" you can see what values are in the x y z

Where are you getting the x y z values?

Yonkers

  • Playmaker Newbie
  • *
  • Posts: 6
Re: How do I create a sprite where my mouse clicks?
« Reply #4 on: February 12, 2018, 09:35:42 AM »
From the vector 3. X Y Z thing. Its saying (0.0 0.0 0.0)

I mean, I might just have no idea whats going on I just started 2 days ago. Do you have an example of what its suppose to look like?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: How do I create a sprite where my mouse clicks?
« Reply #5 on: March 12, 2018, 04:13:01 AM »
Hi.
Sorry for the late reply

The Action "Set Vector 3 X Y Z" will only set a vector 3 variable.

So first you need to get the mouse position (mouse x / mouse y) and then use the these variables on "Set Vector 3 X Y Z" mouse x on x / mouse y on y / 0 on z (or a different value if you want a certain distance)

Another possibility is to use 'mouse pick' or 'mouse pick 2d' and get the store point.