söndag 17 november 2019

Combining the logic

Screenshot of gameplay

A lot of things are coming togheter now. When I started writing this blog post the art was mostly just squares and the background black like in this image. The idéa was originally to have the game be more or less exactly like Worms. However, we later decided to let the players jump in any direction and also possibly change walking direction while in air.

The timer has also been added. A boolean checks if the turn is over, and if so the game switches who plays. A bug exists if that a spell splits into other spells there is a short context switch, so the game will switch turn while the splitted spell projectiles still fly. This could be fixed in a lot of different ways but it's not entirely clear which way is the best. One way is to just add a delay before truly ending the turn and check if there still are any projectiles in the air. While this could work, I personally don't like having a constant time always being added if there could exist a better way.

There was a problem that has been fixed now. The issue was that the aim is supposed to be in a oval shape around the player objects, if the shape isn't a square. So initially we used a unit circle for aiming towards the mouse pointer, however this clearly don't work as it should as seen in one of the images due to the aim being an elipse.

To solve the problem I searched the internet via Google, especially for StackOverflow posts. On StackOverflow I found a good post about how to have a point go along an elipse by using a quite sophisticated equation, shown in this link: https://math.stackexchange.com/questions/22064/calculating-a-point-that-lies-on-an-ellipse-given-an-angle/22067#22067

This worked exactly like I wanted if I also multiplied by 2 after following the equation. I am not entirely sure why I needed to multiply by 2, but my assumption is that otherwise it's just the arrow tip that collides with the elipse, but I wanted the arrow to point out from the edges.

Inga kommentarer:

Skicka en kommentar