Discuss Scratch

Wiltonfs
Scratcher
6 posts

Stealth/Cones of Vision

Hey everyone!
Recently, I have been developing a game that has a stealth aspect to it. The game is very similar to this game: https://sites.google.com/site/millseagles/home/Games/Adventure/ultimate-assassin-2
but it incorporates lock picking, stealing, and other less violent aspects. Now, the only problem I have is the vision. I am not new to Scratch, and I am quite reasonable at doing relatively complex bits of programming, but this part has kinda stumped me. The thing is, I need cones of vision. They might be visible, probably won't. The only thing that I need, though, is that if they hit the sprite called “obstacle”, they don't pass through it, but will still continue on both sides. If you need to see what I mean by this: https://scratch.mit.edu/projects/104515852/ . How should I do this? I was thinking tons of clones that are tiny and stop when they hit the obstacle, but that will cause lag and limit the number of guards I can have. Does anyone have any ideas? I am completely open to suggestions.
Doyousketch2
Scratcher
93 posts

Stealth/Cones of Vision

Set your pen to use alpha.

While this is not normally used,
you can set the RGBA values as variables,
then multiply them out,
and pipe the value into the “set pen color” block.

Send your pen out 'till it collides with an object or wall,
turn off pen, then jump back to character.
Turn a degree or two, then repeat.

https://scratch.mit.edu/projects/104561879

Last edited by Doyousketch2 (April 8, 2016 02:29:20)

Wiltonfs
Scratcher
6 posts

Stealth/Cones of Vision

Thanks! Am trying out a modified version of it now!

Powered by DjangoBB