Shooting "bullets" towards the location of the mouse from the actor - Not Workin

jlsheriff

  • Posts: 34
I followed Abigale's tutorial instructions on how to get the bullets to fire from the actor center towards the location of the mouse.

With the attached code that I've quadruple checked for errors, it is working with some issues.

The "bullet" actor IS being created at my character, although it isn't the center of it.  They come from the bottom right of the character. I have the characters origin in the center.

The bullets are moving at the correct velocity, but they are not going towards the mouse's location.  If I move the mouse towards the bottom right of my screen (outside the bounds of the game), I can find the origin of where it is calculating where the center of the actor is.  I don't understand why it is doing this so maybe you guys can spot a problem in my code.

Thanks!
Destiny Island - Work In Progress http://www.stencyl.com/game/play/15851

Tuo

  • *
  • Posts: 2469
Check to see if the bullets are in a colliding shape that hits players. I think that tutorial has you making your own collision group (can find them in the Settings button) just for the bullets so that it only will collide with the enemies. That is very likely the issue.
Don't look to me but rather to the One who is the reason for what I do. :)

If you need help, send me a PM. Even if I haven't been on in the forums in ages, I still receive those messages via email notifications. You can also reply to any of my forum posts, regardless of the age (especially if I created it), and I will likely reply.

If you want to see the programming behind certain types of games, feel free to check out my "Demo-" games on StencylForge (http://community.stencyl.com/index.php/topic,16160.0.html)

coleislazy

  • *
  • Posts: 2607
You need to add the camera coordinates to your mouse coordinates.

Mouse coordinates report relative to the screen (0,0 is the top-left of the screen).
Actor coordinates report relative to the scene (0,0 is the top-left of the scene).