Shooting only when actor is in the same row

hman360hman360 Member Posts: 590
edited November -1 in Working with GS (Mac)
I tried to do this many ways, any help.
Here is what I'm currently trying:
Put invisible actor on each row stretched to fit. If enemy overlaps it, the change attribute, row 1 enemies to 1. I did this for every row.

I want it to shoot only when there is an actor in the same row. And, the "gun" is spawned in different rows. Is there any way where I can use the same gun actor for all rows and to determine in which row the gun is in and so I can have it pick up the other attribute to make it shoot or not?

Comments

  • quantumsheepquantumsheep Member Posts: 8,188
    I'm not sure if Im understanding right, but you could just have one gun doing it what it does (I'm assuming moving up and down)

    In your gun actor, have the behaviour:

    Constrain self.positionX to PlayerX

    (playerX is a global variable)

    In your enemies, have the rule:

    If self.X = PlayerX

    Then change attribute "Shoot" to true
    Otherwise Shoot = False

    In your player, have a rule that says:

    If Shoot = True
    Spawn bullet

    And in your bullet just have a move to the right rule.

    Does that help?

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

Sign In or Register to comment.