I'm pretty new to Scratch programming, and I'm trying to reproduce a game I was working on in Excel VBA (a remake of the old Atari 2600 Adventure game).
I want to have a small rectangular sprite that can be moved around within a background, but I'd like the walls of the background (anything that isn't gray) to be impenetrable. However, there doesn't seem to be an elegant way to do this, since the collision detection only allows you to check for contact with other sprites, certain colors, etc.
Any suggestions on this?
Thanks!
Offline
<touching [edge v] ?>
Last edited by Molybdenum (2012-09-22 18:35:13)
Offline
I thought about using that; the problem is, unfortunately, that the background has some scattered walls and borders that I would like the sprite to treat as solid.
It looks like this: http://i.imgur.com/flX2o.png
Offline
jdb-44 wrote:
I thought about using that; the problem is, unfortunately, that the background has some scattered walls and borders that I would like the sprite to treat as solid.
It looks like this: http://i.imgur.com/flX2o.png
touching sprite [wall v]?
Last edited by Firedrake969 (2012-09-22 19:03:22)
Offline
jdb-44 wrote:
I thought about using that; the problem is, unfortunately, that the background has some scattered walls and borders that I would like the sprite to treat as solid.
It looks like this: http://i.imgur.com/flX2o.png
If you want to, you could just use:
<touching color [yellow]?>
Offline
Firedrake969 wrote:
jdb-44 wrote:
I thought about using that; the problem is, unfortunately, that the background has some scattered walls and borders that I would like the sprite to treat as solid.
It looks like this: http://i.imgur.com/flX2o.pngtouching sprite [wall v]?
Except that "wall" in your example refers to a sprite, correct? I will go that route (making sprites for the background) if I have to, but I'd prefer not to, if at all possible.
Offline
jdb-44 wrote:
Firedrake969 wrote:
jdb-44 wrote:
I thought about using that; the problem is, unfortunately, that the background has some scattered walls and borders that I would like the sprite to treat as solid.
It looks like this: http://i.imgur.com/flX2o.pngtouching sprite [wall v]?Except that "wall" in your example refers to a sprite, correct? I will go that route (making sprites for the background) if I have to, but I'd prefer not to, if at all possible.
You don't have to if your walls are all the same color, but if they aren't then you will have to do what Firedrake969 suggested.
Offline
ErnieParke wrote:
jdb-44 wrote:
I thought about using that; the problem is, unfortunately, that the background has some scattered walls and borders that I would like the sprite to treat as solid.
It looks like this: http://i.imgur.com/flX2o.pngIf you want to, you could just use:
<touching color [yellow]?>
Hmmm...is there a way to refer to a color by number, perhaps, with a variable? So I could say have an expression like: "touching NOT the color [hallway color]".
Offline
jdb-44 wrote:
ErnieParke wrote:
jdb-44 wrote:
I thought about using that; the problem is, unfortunately, that the background has some scattered walls and borders that I would like the sprite to treat as solid.
It looks like this: http://i.imgur.com/flX2o.pngIf you want to, you could just use:
<touching color [yellow]?>Hmmm...is there a way to refer to a color by number, perhaps, with a variable? So I could say have an expression like: "touching NOT the color [hallway color]".
As far as I know, no, you can't, but you can use this:
if <<<<(hallway) = [yellow]> and (touching color [#fcff00]?)> or <<(hallway) = [orange]> and (touching color [#ffa800]?)>> or <more...>> do something end
Last edited by ErnieParke (2012-09-22 21:05:22)
Offline
I think I have it!
I've made a background (gray) that will always be visible.
The rooms will all be represented in a single sprite that has multiple costumes.
The rectangle "character" will check for contact with the sprite (that is, the current costume of the sprite, representing Room # X.
Now...to enable picking up and carrying objects!
Thanks again for everyone's input!
Offline