Team 12 report 4 – Angular object placement

Hello everybody! This week has been quite rough and the task I was presented with was a real challenge. This week I tackled object placement in our 2D sidescroller. The objects in our game should be placed dynamically to fit into the levels we create. The levels will not only be on a horizontal axis, they will angle down and up to create a better gameplay experience. This was a very challenging task and down below I will describe what I have made, how I made it and why I made it.

Why our game needed a dynamic object placement: The game will as above stated feature angled backgrounds and segments that will go up and down. To get all of the objects placed in a good fashion without ”hardcoding” their placement a system will be needed to find out where the objects should be placed within the level.

So what is this that I have made? I made this system that reads the backgrounds orientation, placement and angle in order to place out the objects and obstacles in our game in the right X and Y coordinates.

Here is the interesting part and where most of the blogs content will be. How I made the system and how it works on a more technical level. I will try to describe it as down to earth as I can but it is not a simple system and to be honest I don not understand it myself 100%, I just know in theory how it works.

The backgrounds are the key to this system. Marwan Al Salman in my group made the background change their position and angel using the law of cosinus. This made it so that the backgrounds where placed ontop of each other while overlapping to create a fluent level.

The system I made was an extension to his system and builds ontop of his code. What it does is that it has functions that gets the backgrounds angels from the backgrounds while also taking the top left position of the background. When the functions have taken these variables I place out the objects on the top left corner of the backgrounds, after that I get the angel from the background and use it in a function which uses the law of cosinus to calculate how much the X and Y values of the objects are going to change. In practice this creates a line where all of the objects spawn. Featured image

If my explanation of the object placement system was unclear I hope this awsome paint picture can do some talking and give a visual representation of how it works.

1 tanke på “Team 12 report 4 – Angular object placement

  1. folkedaawesome

    Hey, I’m here to give you some feedback on your post. First of, I like the way you describe things. You really say they words ”what, how and why”. This gives the reader a headsup and make it easier to go back in the post if there was anything unclear.

    Second: I find it a bit unclear what your work does. Not how it is done, because your awesome paint picture help describes that, but what you need it for. You take out the coordinates so that you can place objects? Is it interacteble objects or just assets?

    Third of, about the post. You should tag it with 5SD033 and not 5SD022! I could’t find it on Bable, maybe something you should look up?

    I am really curious on how the whole thing works. You said that your not sure 100% what it does but try to describe it even futher then you did! I’m very exited on how you did this on an even more detalied describtion!

    This must have been really difficult for you! I would love to read about if there were any particular part that was extra hard or if you encountered any problems. The reader of your post maybe have done the same thing and maybe wanna come here to look for a way to solve their own problems. It will be fun reading futher post from you!

    Gilla

    Svara

Lämna en kommentar