Is this possible?

Stuck at a level? Need help with R'n'D or anything R'n'D related? Post here!

Moderators: Flumminator, Zomis

Post Reply
User avatar
Gavin_
Posts: 16
Joined: Mon Feb 25, 2008 9:01 pm

Is this possible?

Post by Gavin_ »

First of all hello people I don't think I've been here for approx a year :D

Is it possible at all to have a CE change into something when it is surrounded i.e. have something other than empty space on either side of it?
User avatar
Francesco
Posts: 577
Joined: Thu Dec 29, 2005 2:22 pm
Location: Sardinia (Italy)
Contact:

Post by Francesco »

Hi Gavin, welcome back to the forum.

I'm happy you posted this question. This is a thing I've asked for before - a "change when stuck" condition - or just like you said, change when surrounded.

I hope this will be added sooner or later, it should already be on Holger's todo list, if I recall it right.
Anyway, by the way, have fun!
Francesco
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Post by Holger »

This is an interesting idea for a change condition, but also a bit tricky:

I think it's possible to distinguish between "change when stuck" and "change when surrounded", where the first one only matches when the CE wants to move to another tile, but cannot (because of being surrounded), where the second one always matches if the four tiles around it change to all being non-empty, regardless of the CE being able to move or not.

The "change when stuck" (or "change when blocked") should then probably also match when enough surrounding tiles change to non-empty so that the CE cannot move anymore, which means that a CE that "can move left" already changes if only one tile (the one to the left) changes to something non-empty.

It's even possible to distinguish between "change when stuck" and "change when blocked" as follows: "change when blocked" could match when the current move direction is blocked, while "change when stuck" could only match when all possible move directions are blocked (for example if the CE can move horizontally and both the tile to the left and the right are blocked by non-empty space).

The problem with conditions like this is that it could be tricky to find out if a CE is blocked or not -- for example, while a CE is turning around to try another direction, the blocking situation around it could already have changed again.

And yes, this is somewhere on my todo list... :-)
User avatar
Gavin_
Posts: 16
Joined: Mon Feb 25, 2008 9:01 pm

Post by Gavin_ »

Isn't it already possible? In the Snakebite levelset the rat CE changes when you wrap the snake around it or does that work by another way?

My idea behind it is to be able to create puzzles where you would have to "box in" an enemy or force them to box themselfs in and then have them explode into diamonds or something when done.
flump
Posts: 22
Joined: Tue Dec 25, 2007 2:05 am

Post by flump »

Isn't it already possible? In the Snakebite levelset the rat CE changes when you wrap the snake around it or does that work by another way?
Just on the left and right side. Doesn't matter in Snakebite because in order to touch the rat on both sides you'll also be touching it on one other side as well, which gives the illusion of encircling it.

To check if a CE is blocked all directions try this:-

CE1 turns to CE2 if touching something,
CE2 turns to CE3 if touching something,
CE3 turns to CE4 if touching something,
CE4 turns to CE5 if touching something.

CE5 is now blocked.

In order to unblock the element, you'll need to work backwards..

CE5 turns back to CE4 if touching space,
etc, etc...

It can't "self check" though, it can only work against items that move around it, so normal walls are out....This is why it worked in Snakebite.

I think it's possible to distinguish between "change when stuck" and "change when surrounded",
Can't you just check to see if empty_space is NOT around it every cycle, then turn to something if it isn't? Would it matter about turning? Even if the element is in mid-turn it would change.
User avatar
Gavin_
Posts: 16
Joined: Mon Feb 25, 2008 9:01 pm

Post by Gavin_ »

flump wrote:It can't "self check" though, it can only work against items that move around it, so normal walls are out....This is why it worked in Snakebite.
hmm that's a pity. What I had in mind was an enemy CE that moves slowly toward the player and leaves walls behind it as it moves, and the player has to trick it into boxing itself in (and having it burst into diamonds when it detects it is trapped).
User avatar
Gavin_
Posts: 16
Joined: Mon Feb 25, 2008 9:01 pm

Post by Gavin_ »

In the CE change settings where it says Touching element xat y side all it would need is an "all" side instead of just left/right/top etc
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Post by Holger »

The problem with this is that currently "left/right" or "any" side means that only one of the selected sides has to be touched by that element, but not all at the same time. So it's a logical OR here. The suggested "all" would be a logical AND.

While this would be technically possible, it would also add confusion, as it would then be unclear if "left/right" would be OR or AND...
Post Reply