Prevent actors from entering regions

Derek

  • Posts: 163
I was wondering if there was a way of preventing actors from entering regions. I've tried setting things up with tile collisions, and made sure that the test sprite for my project was set to collide with them, but said sprite just walked through them.
Don't be a critic on the internet while eating and drinking at your computer.

UnrealCanine

  • Posts: 244
have you tried setting that if character in inside a region to increase/decrease their _y value until they're out?

Derek

  • Posts: 163
I tried that, but the behavior I attempted to do that with prevented the game from running.
Don't be a critic on the internet while eating and drinking at your computer.

Natrium

  • *
  • Posts: 111
Couldn't you use terrain instead? (I don't know, it's not the right solution if other actors have to go inside the areas you don't want this specific actor to enter.)

Derek

  • Posts: 163
The thing is, in this little test scene, the actor isn't supposed to enter the black(ish) part of the scene. Also, I tried finding behavior blocks for terrain, but couldn't find any that could help me replicate the behavior I tried in the first place.

Sidenote: Still can't believe that tile collisions don't work properly in top-down/isometric games.
Don't be a critic on the internet while eating and drinking at your computer.

Natrium

  • *
  • Posts: 111
Terrain is considered as tiles. You don't need a behavior. The actor will collide with it as if it was some tiles.
As I said, the only problem is if some other actors have to be able to enter it, then it would be more complicated.

t4u

  • Posts: 418
I would describe the "sandy" isometric tiles by 4 lines.

x,y -where I will be in next frame based on my speed x,y speed (custom attribute, not stencyl block)

If (x,y inside the sandy region):
     move actor to x,y
else:
     do nothing/stop

USE PICTURES WHEN YOU ASK SOMETHING!
If I helped you be sure to mention it in your game.

Tutorials + downloads:
http://t4upl.blogspot.com/

spoogob

  • Posts: 1106
Can't you use terrain (as mentioned) and then assign groups to your terrain to determine which actors (players/etc) collide or don't collide with the terrain?

yoplalala

  • *
  • Posts: 1632
use something like T4u method If you use collision, this means the character head, for example, won't be able to touch the sky.

Hectate

  • *
  • Posts: 4643
I would recommend against having concave terrain shapes, btw. Might be true for regions also.
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

Derek

  • Posts: 163
@t4u: Thanks for the help. BTW, is that a scene behavior or an actor behavior?
Don't be a critic on the internet while eating and drinking at your computer.

t4u

  • Posts: 418
USE PICTURES WHEN YOU ASK SOMETHING!
If I helped you be sure to mention it in your game.

Tutorials + downloads:
http://t4upl.blogspot.com/

Derek

  • Posts: 163
Just started to establish the base of that behavior t4u suggested. What's really killing me is finding  blocks for things like  the following:

for the moving half:
if <x_position+vx, y_position+vy inside the sand square>
x_positon+=vx
y_position+=vy

for the region creating half:
pretty much the whole apex thing, since there doesn't seem to be a block that covers that sort of thing. And the Stencylpedia, from what I've checked, doesn't have any info on it either.
Don't be a critic on the internet while eating and drinking at your computer.