Hi I am making a game and am begining to progress, have loaded data into an array that maps my level, used the arrays to map the data, added character with animation that moves from left to right with user input and the level scrolls when the player is in the center of the screen and the level is not at the start or end. The character even jumps and there is some very basic collision in place (to avoid him walking off the screen/level or falling into abyss when he jumps).
However I am now looking at implementing collision so instead of defining values the character can't go outside of (the screen or ground level) the program intuitavley notices colision. I want to do this by readining in bounds of areas into array from a data stetement which I have done since thats the easy part. Now the hard part, making use of the data. I have tried to make a collision check system myslef but after a long time of theorising and playing around without success I started searching around on the forums without much success. I can't see many other people trying to create collisions in this way yet I am sure it's a viable method. While searching I came accross sparky's collision detection. Now the real aim of my question is to ask if sparky's collision detection can be used in 2D as most if not all of the demos and examples seem to be for 3D and if it can how could I use it in conjunction with a data statement similar to the following where 1's represent tiles I want the player to collide with.
Data 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Data 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Data 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Data 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Data 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Data 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Data 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Data 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Data 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
Data 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
If i were to have a quick attempt I would think about reading the array storing the above data and making an object for each entry of 1 (if you can make objects for tiles) and then use the other commands in sparky's detection system to determing when collision occurs.
If any of the veterans out there could give me a point in the right direction I would be most grateful. Thanks in advance. David