I need helping help figuring out a behavior. Thank you!

Jedinator

  • Posts: 20
 I have been working on this behavior for the last several days and I just can't seem to make it work.  The picture below is the latest version of what I have tried. It is attached to the Main Player in the Scene. I have tried about 5 other versions and they don't work either.

What I need:

-To spawn a new actor (with support for multiple actor types) in front of the Player when a Control is pressed
-For nothing to happen (or to have the Player "killed") if the Control is pressed too early, or not in the right region (I assume each "spawned actor" would have a region around it.)

This is supposed to be an "endless" or "arcade" type game where the Player is always moving.  To get over randomly created "enemies" (like pits, boxes, monsters, etc) the player has to press the correct button to create a new actor type that will help him over/around the obstacle. 


« Last Edit: May 24, 2012, 04:55:16 pm by Jedinator »

rob1221

  • *
  • Posts: 9472
Try using a region attribute rather than last created region.

Jedinator

  • Posts: 20
In one of my attempts, I tried to use a region attribute to follow the actor that would be spawned in upon a control press. But I couldn't  SET the attribute, because the actor was not present in the Scene yet, because it hadn't been created (it has to be created "in-game").  How would I implement your suggestion?  :) Thanks!

« Last Edit: May 24, 2012, 05:33:01 pm by Jedinator »

rob1221

  • *
  • Posts: 9472
There are loop blocks under Scene > Actor such as "for each actor of type" that might help.

Jedinator

  • Posts: 20
I'll check them out! Thanks!  :D

Jedinator

  • Posts: 20
I am still having two problems:

1. How do I spawn the new actor directly in front of the Player?

2. How do I have an actor recognize a Region that hasn't been created yet?  For example, in my game, the Player is always moving in an endless scene. 

To get past randomly created "enemies" (like pits, boxes, monsters, etc) the Player has to press the correct control to create a new actor type that will help him over/around the obstacle. To get over a pit, he would press "Z" and a Ramp Actor would be created, allowing him to launch over the pit.

I need For nothing to happen (or to have the Player "killed") if a Control is pressed too early, or if the player is not in the right region (I assume each "spawned actor" would have a region around it.)

It was suggested to me to use Regions to accomplish this. However, if the region is attached to the Ramp Actor, and they are created at the same time, how do I get the Main Character Player to recognize a region and thus activate the behavior of checking whether to "Create Ramp Actor, else if not in region, kill self?"

rob1221

  • *
  • Posts: 9472
You can probably check for the keypress on the ramp actor.  Assuming the ramp actor creates the region, you can set it to an attribute referring to the last created region just after the region is created.  Then check if the player is inside that region when the key is pressed.

Jedinator

  • Posts: 20
Can I get some clarification on this statement:

 "you can set it to an attribute referring to the last created region just after the region is created."

I don't quite understand what you mean?  How do I do this?  If you have the time, could you show the blocks used to accomplish this? Thank you so much!  :D

Ryusui

  • Posts: 827
You know about behavior attributes, right?

Add a region attribute to the behavior and set it to "Last Created Region" after the region is created. Now you can refer to that region using the region attribute.
In the event of a firestorm, the salad bar will remain open.

Jedinator

  • Posts: 20
I know about them, but I have trouble implementing them and linking them correctly. How do I "set it to "Last Created Region" after the region is created?" What blocks do I use?

rob1221

  • *
  • Posts: 9472
If you have an attribute of type "region" you can use the attribute setter for it and set it to "last created region".