Button to shoot and shoot another actor

vaingglory

  • Posts: 17
Hello, how are you, I have the following problem, currently I have a trigger behaviors assigned to my player, but every time I move it it also triggers.

I want to create an image that is a trigger button and that when I press it triggers, but I did not shoot the image, but the shot comes out of my player in motion.

If the behivor assigned it to my button only my button shoots me, if the behivor assigned it to the player it is in every movement firing and I can't find a way to hit the trigger button and that the shot comes out of the player, some could help me .

I show the event I use, it is simple, but functional, although I can't get the player to fire when I click on the button;)

Thank you


vaingglory

  • Posts: 17
can anyone help me ?? or the most recommendable thing would be to make a jockstick button

Max Marin

  • Posts: 138
change the mouse from when it's pressed to when it's relased ;D
I'm human

vaingglory

  • Posts: 17
but that is not what I want, but when I press on my button, the shot comes out of the main player

Mineat

  • Posts: 376
Are you sure you have the actor referenced in the push, x and y coordinate blocks carefully?

vicevicebingo

  • Posts: 80
scene behavior?....meh

vaingglory

  • Posts: 17
Hello Mineat
The Player actor does not allow me references in the push, x and y coordinate blocks, it only allows me to reference the Actor group, but not the Player

Hello vicebingo

scene behavior? In case I activate the scene behavior for the button and for the player, both then fire, in case I activate behavior in the player, then it only fires when I give the player and not when I give the button, and in case I activate only the behavior firing for the button only shoots the button and the shot does not come from the player.

I imagine that somehow I have to say that when I press my button the x and y coordinates of the shot are from the player, but the options I have do not allow me to select the player, only the actor group.

That means that my player should belong to the Actor group ?, the problem that the Actor group has no attributes and I have placed all collisions, enemies, etc in the Player group, but this does not allow me to select.

vaingglory

  • Posts: 17
I imagine that I will have to do a custom event, to shoot from a button and that the shot comes from my player, someone has something similar that can happen to me

Thank you

Luyren

  • *
  • Posts: 2810
I have two tutorial videos to recommend.
First about all the attribute types. At the very beginning it explains about actor, actor types and actor groups, which are relevant for what you are trying to do.
https://youtu.be/R7CB7xwoLyo

Second is how to send and receive attributes between behaviors and actors.
https://youtu.be/7KiACqVODgw

Both should be useful for what you want. When created, your player creates your other actor and anchors it to the screen. It should both store the last created actor in an attribute, and send its own value (Self) to an attribute in a behavior of your created actor.

When your created actor is clicked, it triggers a custom event to your player, which now is stored in an actor attribute. That custom event is your player firing the bullet.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.

vaingglory

  • Posts: 17
hello,

 in the end I was able to create the shot with an attribute by rolling true or false when I indicate the button that is pressed and then the event comes out, but I have another problem is that now the button that I put in my scenes does not follow the camera, it stays Fixed and of course I lose it, I have tried to create a different layer, to remove the movement, but it does not continue to stay at the beginning of my game, could you help me?  ;( ;( ;(

Luyren

  • *
  • Posts: 2810
You have to use this:
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.

vaingglory

  • Posts: 17