Answered: Creating multiple enemies that are periodically recycled

nerdster007

  • Posts: 10
Hi All,

I'm working on a Whack-a-mole flash game. For a bit of background: I created an event that creates and recycles moles every few seconds. The variable in the event decrements every time the player clicks on the mole (which also adds to the score). The problem is that I would like to include more than one mole that would be more difficult to catch (ie different variable which begins faster and ends at a lower number).

Here's where it gets wiry: I've found that a lot of features that I want to use to select an actor type only select a specific instance . For example, I use an if loop stating if the mouse was pressed on [last created actor], but what I really want to say is if the mouse was pressed on [actor type mole1] or whatever...

Ok, I'm sorry this question is long. I'm a noobie, and I'm more of an artist, so I really appreciate any technical help you can give. I have wasted 8 hours (no joke) wrestling with this problem.

Thank you so much for your help!!!

« Last Edit: July 09, 2012, 04:53:37 am by nerdster007 »

rob1221

  • *
  • Posts: 9473
There is a "type of __" block under Actor > Properties that you can use to check if the last created actor is of a certain type.

nerdster007

  • Posts: 10
Please forgive my ignorance: Could you elaborate on that?

I found  said block, but I'm not sure how it will allow me to check to see if it's from a certain actor type.

I'm new to Stencyl, and programming, so again I appreciate your patience.

rob1221

  • *
  • Posts: 9473
Right, you'll also need the actor block under Scene > Actor and the actor type block under Actor > Properties.

nerdster007

  • Posts: 10
Hey Rob,

Thank you for taking the time to help me. I've played with those blocks before, and again, and I still am unable to use them and select an "actor type." As I mentioned, I've changed the strategy and placed an instance of my actor in the level, but then it's only that one instance, and apparently recycling is actor type specific while the buttons you suggested seem to be instance specific.

If I am missing something, could you specify how you would use those blocks to accomplish the task?

Thank you again for your help.

rob1221

  • *
  • Posts: 9473
Nevermind, I thought you were trying to get the type of the last created actor.  Probably the easiest way to check if an actor of a certain type was clicked is to move that part of the behavior onto the actor types themselves.

nerdster007

  • Posts: 10
Thank you for pointing me in the right direction Rob  :). I really appreciate the help! I think that should do the trick.

PS I believe I started with that part of the behavior in the actor type, but I was unaware of game attributes at the time...lol so I couldn't tie the actor type's behavior to the score.

Thanks again!