Spell working, but problem with destroy behavior

butterbeanbutterbean Member Posts: 4,315
edited November -1 in Working with GS (Mac)
I have the left and right spell working now for my character, the problem is, I've put a Timer behavior in there that after 3 seconds, the spell destroys itself so it doesn't keep wrapping since I have wrapping enabled for other reasons

The problem is that in my "left spell" rule, when I put the destroy behavior in that, that the game crashes

I think it's colliding with my other right spell rule's destroy behavior, and wants to destroy the left spell before she casts it, thus it freezes...

I tried constraining the spell to destroy it when it hits other areas to avoid using the destroy rule, but it still wraps around...

Any reason for this? Any help appreciated!

Comments

  • quantumsheepquantumsheep Member Posts: 8,188
    Make it so that the spell is destroyed if it reaches a certain part of the screen.

    e.g. in the spell actor:

    If self.position.x is greater or equal to 470 then destroy actor.

    Do the same with the left one.

    If self.position.x is smaller or equal to 10, then destroy actor.

    That should work.

    The actual screen is 480 pixels across. By destroying the actor 10 pixels either side of the screen you destroy it before it reaches the end and wraps around.

    Hope that's clear and helps,

    QS :)

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

  • butterbeanbutterbean Member Posts: 4,315
    I constrained all those attributes but they still wrap through the other side, and I need to enable wrapping for animation reasons.

    What if my scene is 320 X 2560, do I constrain the x position to less than 10 and greater than 2550 or so on, or still constrain the way you described?

    It would be much easier if I could figure out why the destroy behavior with the other spell causes the game to freeze....
Sign In or Register to comment.