playMaker

Author Topic: Bullet shooting at the Player  (Read 2940 times)

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Bullet shooting at the Player
« on: September 30, 2013, 07:25:43 PM »
Hi!
I have a bullet going slowly horizontally over the screen. When the bullet passing the X-position of the Player, I want it to shoot at the Player.
What is the best way to do this? Can I use Raycast for this? I have never used Raycast, so I need some help with that.

I was also thinking I could have a sensor or something which is attached to the player, and when the bullet hits that sensor, it will shoot against the player.
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Bullet shooting at the Player
« Reply #1 on: October 01, 2013, 03:16:50 AM »
Hi,
 
You should use triggers for this. Have you used triggers before?

bye,

 Jean

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Bullet shooting at the Player
« Reply #2 on: October 01, 2013, 04:56:28 AM »
Yes, I have used triggers before, but how should I set it up? I tried to have a long bulletdetector checking the bullet horizontal and vertical. And this bulletdetector is following the player. It's working in a way. But what would you do? Should the FSM actions be on the bullet or the bulletdetector?
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Bullet shooting at the Player
« Reply #3 on: October 01, 2013, 03:57:43 PM »
How can I get the bullet to shoot against the player? Depends if the player is below or above the bullet. And I want it to shoot straight against the player, not following it.
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Bullet shooting at the Player
« Reply #4 on: October 02, 2013, 02:35:52 AM »
Hi,

 can you make a quick drawing? I am not sure I follow.

re triggers, you put the action where it makes more sense for you, the bullet could be checking for the trigger and self destroy and applay damage, or the player could check for buller and then destroy the bullet and apply damage to self. Generally, I would suggest that the bullet implements the logic.


bye,

 Jean

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Bullet shooting at the Player
« Reply #5 on: October 02, 2013, 04:07:49 AM »
Hi!
You can take a look by yourself!
The only problem I have as you can see of this example, is that the bullet is shooting against the player, but only when i'm below the bullet. I know why! Because the bullet is set to shoot down. Not directly against the player as a target, if you know what I mean! I don't know how I can shoot at the direction of the player. So I need help with that.

It's better you take a look at it, instead of that I try to explain :-)
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Bullet shooting at the Player
« Reply #6 on: October 02, 2013, 05:36:36 PM »
Finally, I made it all alone! So now it's working!  :D
I'm very proud of myself now. And very tired in my brain! :-)

I can upload the end result!
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Bullet shooting at the Player
« Reply #7 on: October 02, 2013, 05:50:17 PM »
Here is the working file!
I'm sure it's more than one way to do this, but as long as it's working, I'm happy!:-)
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Bullet shooting at the Player
« Reply #8 on: October 03, 2013, 02:05:30 AM »
Hi,

 congrats! there is nothing better than a tired brain, that's how you'll learn and gain true expertize! :)

 Bye,

 Jean