Creating LOS or flashlight shadow

code
‮edoc
code⁣

#41

Ok I guess I’ll do that… thanks.
Also, how do you do the collision detection without the detection block? I don’t think I did it right


#42

The easiest way is to test if the point is within the shape of the object, which of course depends on the shape of the object.

For a rectangle (with rotation of 0 or 180 only)
where
• Px, Py are x & y position of point to test
• Rx, Ry are x & y position of the rectangle
• Width, Height are traits of the rectangle

When
Abs(Px-Rx)<=Width/2.88
And
And(Py-Ry)<=Height/2.88

Note:
The 2.88 comes from (Height/2)/1.44, where the 1.44 is a scale factor because the object’s height & width properties include “white space” around the object (because of the way the images were created)


#43

Thanks! I got it done!


#44

Looks good :+1:
(btw, I edited the equation above to account for the scale factor)


#45

Sweet thanks! Now I have to figure out how to make it into a game…


#46

@ThatEnglishMuffin
@Hopscotcher
@CreationsOfaNoob
Do you have any ideas for using this concept?
(Sorry for tagging…)


#47

Well, I’m not any of those people lol, but I suppose a game where you have to chase always these monsters that come in the dark, and you scare them away with the light?


#48

That would work but remember that it’s kinda slow…


#49

Okay, let me try the project when I have time, but meanwhile I have to go, I hope I can think of something that works as a suitable game!


#50

K sounds good. Here is another link


#51

Update your bio to 4 features


#52

Remember? You were doing some bank heist game?


#53

Oh ya duh… thanks for the reminder! I’ll start working on that


#54

Could you post a project that is sideways then unpublish it so I can have a sideways template?


#55

Ok. I’ll get you a link.


#56

Thanks! I’m stuck with a phone bc my bro hogs the Ipad…


#57

https://c.gethopscotch.com/p/100mk6vbo9
Go to the banner at the top saying “Open in Hopscotch”


#58

Thanks! I got it


#59

Just FYI, there’s a pretty minor edit you can do to enable for updating every frame.


#60

What is it? It would be helpful