destroy/spawn actor problems

alpha-beta-gameralpha-beta-gamer Member Posts: 14
edited November -1 in Working with GS (Mac)
Hi there,

i'm new to gamesalad but i already love it. i want to make an arcade game like in the tutorials... but:

i want to have 3 different coins (A, B, C).
if the ball hits a C coin -> destroy that C coin & spawn a B coin instead*
if the ball hits a B coin -> destroy that B coin & spawn a A coin instead*
if the ball hits an A coin -> destroy that A coin

*of course exactly at the same place the old coin has been.

Question now is:
How to DO that?! Problem is, that i might have 5 C Coins, 3 B Coins and 10 A Coins in one level. And i just want to have that particular Coin the ball has hit altered/destroyed. Can I do this with just 3 actors (1xA, 1xB, 1xC-Coin) or do i have to make 18 actors with 18 x n attributes?

Any options?

Comments

  • StuartYStuartY Member Posts: 134
    This won't be a problem! You just need three prototypes, A, B and C. Then put rules on them just like you described. It won't affect all the versions of the coin, just the one that is hit. It might be more efficient to just consider changing the graphic of the coin that's hit, and an internal variable called "state" registering whether it's 1,2, or 3 (C,B or A). Then you'll only need one prototype, and you can "unlock" and change the state of coins that you want to start life as "A" coins.

    Love your username BTW, very clever!
  • alpha-beta-gameralpha-beta-gamer Member Posts: 14
    sounds even better and is exactly what i had in mind (the thing with the state-changes). i'll try this out. thanks! :-)
  • alpha-beta-gameralpha-beta-gamer Member Posts: 14
    hm... not that easy.
    not working right now. here is, what i've done so far:

    coin C:
    contrain attribute "game.coinstate" to 3 (integer)

    rule: on collide with ball + if game.coinstate = 3 ->
    - change image to coin B
    - change attribute "game.coinstate" to 2

    rule: on collide with ball + if game.coinstate = 2 ->
    - change image to coin A
    - change attribute "game.coinstate" to 1

    rule: on collide with ball + if game.coinstate = 1 ->
    - destroy

    When i'm testing, the coin is instantly destroyed.
  • alpha-beta-gameralpha-beta-gamer Member Posts: 14
    Ha! Found the problem:

    I just had to set the coinstate-attribute to 3 by default.

    Problem NOW is:
    It counts for EVERY Coin. So if Coin 1 gets 2 hits, Coint 2 is destroyed instantly, because the attibute is at 1. Is there a way to have it individual for every coin without having to have as many attributes as coins in the game?
  • alpha-beta-gameralpha-beta-gamer Member Posts: 14
    i DONT get it!

    if for Coin C i make this rule, everything works fine:

    "if collide, change attribute self.image to Coin B" - works fine-

    if i add a conditon for a 2. hit:

    "- if collide, change attribute self.image to Coin B
    - if collide + self.image is Coin B then change attribute self.image to Coin A"

    -> does not work. Coin C jumps on first hit to Coin A. Any suggestions?
  • alpha-beta-gameralpha-beta-gamer Member Posts: 14
    alpha-beta-gamer said:
    i DONT get it!

    if for Coin C i make this rule, everything works fine:

    "if collide, change attribute self.image to Coin B" - works fine-

    if i add a conditon for a 2. hit:

    "- if collide, change attribute self.image to Coin B
    - if collide + self.image is Coin B then change attribute self.image to Coin A"

    -> does not work. Coin C jumps on first hit to Coin A. Any suggestions?

    Problem's still there, folks! :-) C'mon!
Sign In or Register to comment.