Skip to main content

Prisms and Frog Legs

·381 words·2 mins

Regarding those performance issues I started seeing yesterday, I don’t see any issues with mirrors it’s just the prisms. One major difference between the two is the reverse ray casting. Am I instantiating a new RayCast2D every frame?

Aha!

It was even worse. I was instantiating a new one every frame and not removing the old one so the number of instances just kept climbing.

Whoopsie. Glad that’s sorted.

K, so what do rectangular prisms do? They can shift a beam laterally while keeping it parallel to the original beam. Here’s what that looks like:

It can also perform a turn. From about 45° to almost 180°. Though, I don’t think I’d put the player through having to line up a 180° turn.

Here’s a 45° turn.

And nearly 180°.

The triangular prism can do a 90° turn using internal reflection.

It can also do a smaller turn along the hypotenuse.

One of the most interesting uses might be the 180° turn.

I saw this used in binoculars. The distance between human eyes would limit the size of the lenses that could be used in the binoculars but a pair of triangular prisms can create some extra room. Apparently the real name is Porro prism.

Here we go:

I think my favourite use for these will be to allow light to pass through an area of fog or smoke or something. But that obstacle does not yet exist.

Might be time to learn how to do tile maps. My current methods for placing walls are slowing down level design quite a bit so.

Frog Swim Animation
#

Switching gears a little bit. I’m trying out Godot’s AnimationPlayer by creating a swim animation for a frog. I sketched out what that might look like a couple days ago:

It took some effort and a couple YouTube videos to wrap my head around Godot’s animation UI. I forgot how much time I spent doing animations in Flash back in the day. That experience definitely helped me here.

I might need to break it up into separate recover and push animations so I can change the tween curve for one without messing the other one up. I’ll probably want that anyway so I can control the playback based on controller input.

Lots to learn.