How do i do it?

circlelinecircleline Member, PRO Posts: 37

Hey guys, I'm new to game salad. I'm an Amateur programmer. My question is that umh..... I made a rule that when i hold down key 'a' the actor will destroy itself. Since there are 2 actors of the same prototype in the scene and when i hold down the key 'a' both actors are destroyed at the same time. I want one actor to be destroyed each time i hold down the key 'a'. How can i do that?

Thanks!

Comments

  • SocksSocks London, UK.Member Posts: 12,822

    @circleline said:
    I want one actor to be destroyed each time i hold down the key 'a'.

    Which one would you like to be destroyed ?

  • circlelinecircleline Member, PRO Posts: 37

    Both..but one by one not all together.
    *note: both actors have to same code. They are from the same prototype.

  • SocksSocks London, UK.Member Posts: 12,822

    @circleline said:
    Both..but one by one not all together.

    That's kinda' my question, of the two actors, which one would you like to destroy first ?

  • circlelinecircleline Member, PRO Posts: 37

    either one.

  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2014

    @circleline said:
    either one.

    If you can't differentiate between them, that's to say that you cannot select one for deletion (and articulate that selection) then neither will GameSalad be able to select one (or any computer system).

    Which is kind of the point of my question. You need to be able to differentiate between them, or given them any value that can be used to select one over the other.

    Hope that makes sense !

  • circlelinecircleline Member, PRO Posts: 37

    thanks! in what way you think i should think that i should differentiate? make another prototype? add attributes to instance actors?

    Next question: how do i loop enemies to spawn in a defined area? what i mean is that to let enemies spawn continuously in random coordinates.

    thanks once again!

  • SocksSocks London, UK.Member Posts: 12,822

    @circleline said:
    thanks! in what way you think i should think that i should differentiate? make another prototype? add attributes to instance actors?

    I'd option+drag your prototype to make a second copy and rename it as something else.

    @circleline said:
    Next question: how do i loop enemies to spawn in a defined area? what i mean is that to let enemies spawn continuously in random coordinates.

    thanks once again!

    Timer - every X seconds
    Spawn enemy - position relative to scene - x = random (left most position, right most position) - y= random (lowest position, highest position).

  • circlelinecircleline Member, PRO Posts: 37

    @Socks said:
    I'd option+drag your prototype to make a second copy and rename it as something else.

    That's what i did but again when i hold down key 'a' all of them gets destroyed together? I want it to happen one by one..what is the most convenient way to do that? Thanks!

    2nd Question answered! Thx

  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2014

    @circleline said:

    That's what i did but again when i hold down key 'a' all of them gets destroyed together?

    I guess that's because the two actors have identical rules ?

    Maybe have a game attribute 'x'.

    In the first of the two actors, when a is pressed change x to 1 and destroy.

    In the second actor, when a is pressed and x is 1 destroy.

  • circlelinecircleline Member, PRO Posts: 37

    Thanks for the answer..i figured a way out already!

  • circlelinecircleline Member, PRO Posts: 37

    I need suggestions: So..I am wanting to create waves in my game. How should i do it so it's easy for me? (when i say waves, i mean like enemies coming into scene and the speed it comes in at...and all that)

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @circleline unlock the one the one that you want to get destroyed. and then take out the rule that when "a" is pressed destroy this actor out of your prototype :) hope you understand what I mean

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    Oh I read down in your comments so what You can do you can level them but still unlock one actor and since you don't want them to be destroyed at the sametime put a timer in the one that you want you want to get destroyed after. Something like this

    1.When "a" is pressed
    2. Timer after x seconds (substitute the time you want for x. You can even use 0.1 seconds or 0.001 and so on)
    3. do Destroy this actor.

    @circleline

    it seems like a very easy fix but it seems that you're not explaining it well

Sign In or Register to comment.