GameProgramming 1 – Week 6
|
More advanced collision and animations. The rest used to really get started with the project work. Animations was basic, well I say basic but everything we learn right now is technically basic but from our perspective it is not, it was about loading the duration, position and size of each picture from a text file and then letting the program show them. You have a sprite sheet that shows a figure and then you figure out the position and size of the figure, placing all this information in a text file along with where to find the sprite sheet, the name of the sprite and how many pictures (single sprites) there is to be. Then we can make the program read this and use the information in the text file to know what part of the picture to draw and how many different to use. Having previously learned basic collision (last week) we moved on to a bit more advanced collision, how to check different kinds of objects if they collide. A collision with two objects that is square is one thing for example it is a basic one but having a ball and a square collide, how do you do it? Well one need to check where on the square the ball meets it cause it is different depending on where, the edges makes it a bit longer. Decided to copy the animations project and use it for the base of my project, it might not have been the best choice since we had not been part in writing the last version and many changes had been made (classes removed, changed and some added), so there I stand and have no real clue as to how this version is built. Right only one thing for it, read it through and figure it out, it was basically still arkanoid but a lot removed or unused. But this was used to play an animation so why not find some sprites to use and try to make some animations of my own. Since I am going to need a bunch of them if I am to do the game as complete as possible, it is technically not needed for a functional game. But the game would be quite dull and expressionless without animations. Wednesday to Friday was basically questions and answers, you are meant to sit there in the classroom and work on your project unless you feel you already get everything and will not need to get any help. Well I felt that not using this time that was given before you go away for a couple of weeks and that can be used to really get started on your project would be a bit wasteful, can not say that I had many questions but a few. In programming and real life things might seem like they are really logical but then turns out to not be so or just really complicated. Well one thing I am going to need in my game(super mario bros 2) is gravity and how it works in reality is very logical and (simple) but is it that when programming it. Yes it can be logical and simple, it all depends on how you do it, one way that would be useful is to always have a velocity downwards and when you jump you negates it by having a second variable in the calculation that starts on a certain number then decreases after a certain amount of time until it becomes zero, which will be the turning point in the air when things are technically without gravity, then it will start to go down again and finally land (provided there is ground beneath ). As long as there is ground nothing happens but if you step over a cliff (or just a place where the ground ends) you will fall down. Also made arkanoid work with the keyboard instead of the mouse which can be useful since the game I am making is to be controlled with the keyboard, could be tricky otherwise if I had not figured out how, though when I say I figured it out I mean that it was through the lessons on sdl by Lazy Foo’ and that others asked how you could do it and got answers from the assistant teacher. |