Mosue to sprite ????? i need help

GeminisLOL

  • Posts: 19
Guys, I had to try to create a code that allows you to change the sprite to my character depending on the position of the mouse.

Example
if the mouse looks down, my character's still-R sprite changes to still_down

what happens is that I do not understand the logic to create the code.
if someone knew about this topic please help ???

JeffreyDriver

  • Posts: 1868
How many directions/animations to you need to account for?
Current Projects:
Horror Point & Click Episode 1.
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

GeminisLOL

  • Posts: 19
all directions is for a shooter

« Last Edit: October 09, 2018, 08:33:15 am by GeminisLOL »

JeffreyDriver

  • Posts: 1868
So you need a point to mouse behaviour?
Current Projects:
Horror Point & Click Episode 1.
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

Luyren

  • *
  • Posts: 1522
I think he wants to change animation based on the angle of the mouse from the player. You can use the atan blocks (the same you are using for the weapon facing the mouse), to get the angle from the mouse to the player. If the angle is within some preconfigured values, change animation. For example, if the angle is bigger than 45 and smaller than 135, you could change your animation to facing down.
Working.

GeminisLOL

  • Posts: 19
Thank you very much for the help

but which block should I use to change sprites ???

« Last Edit: October 09, 2018, 10:56:28 pm by GeminisLOL »



GeminisLOL

  • Posts: 19
I made this code and it does not work for me.
Someone would know how to tell me why, what is wrong.
https://drive.google.com/open?id=1VjD1nJ8-pQZ2Gx6hXl5FY0aMMVyxxOgo

Luyren

  • *
  • Posts: 1522
I made this code and it does not work for me.
You have to tell us what is happening, instead of just "it doesn't work."

From your image, I can see you are comparing initial angle to those numbers. You want to compare "angle", the one you are setting with the atan block. And from the description of what you want (animation based on mouse position), you don't want to use that "point self" block.
Working.

GeminisLOL

  • Posts: 19
I do not know much about the program.
I want my weapon to change sprite depending on the location of the mouse and I have no idea how to do it.
If you could give me some visual example, I would like it

GeminisLOL

  • Posts: 19
after so much looking at what you had written to me earlier I made it XD
Thanks for the help :)

Luyren

  • *
  • Posts: 1522
Glad you got it working.
Working.