GamePrograming1 – week 8
|
Great expectations. This is the week things really need to start to happen, since it only be about two weeks left after this one before the game needs to be finished. Though it needs to be presented at least 3-4 days before the deadline, though I do not know what the presentation entails I expect me to have a game to present. So started of with creating an animation sprite of Mario and programmed it so he could be controlled with the arrow keys on the keyboard. It is a bit difficult to get the game to be controlled with the arrows since they have a have a complete different system of how they get their values and what their values are. SDLs checking if key is down will return the value of that key (They have an enum list of all the key where they are assigned values) and in my code the value represents an element in an boolean array with 256 elements and is set to true if pressed and false otherwise. A problem with the keys assignment is that normal symbols down to ‘z’ follows the ASCII- table and have the same values, but the arrows and caps lock etc. have values starting at 1073741881, so it might be a little problematic to assign it to an a part of the array (since it only holds 256 elements). So the alternative for me is to set it on a different position(element) in the array. Since ‘z’ have the value 122 a good idea could be to take a value after that since none of the others holds them, when it comes to key presses. Started of with trying to get blocks that the character can collide with and later stand on so I can test gravity, but alas it do no want to work, for some reason the sprites are not drawn. So they are not on the screen, but the code seems right. This needs more research to find out why and get it to work. |