Calculator Community > Casio Calculators

Side Scroller

<< < (2/2)

kucalc:
Ok, I'm back and I really need some help. I found a good scrolling algorithm from here: http://greggman.com/headlines/2000/200-1-19g.htm

I have been successfully able to use the source code in my game and the scrolling works perfectly. Now, what I want to do is give my tiles attributes, like if my character is on top of the ground tile, Y-coordinate of the player stays the same. How do I do this? Can someone give show my an example source code? Thanks in advance and I appreciate it.

tifreak:
I am glad that you were able to get it figured out. :)

I am sorry that we were unable to help, but it seems our C guys have not been on omnimaga for a few days.

bfr:
Well, there are a few ways to do this.  Here's an example of how I test for collision in Omnimaga - The RPG:

if(map_base[(unsigned int)(y+48)/16][(unsigned int)(x+64)/16]==22){
//...code...
}

While that code might not even be "proper" and my weird integer conversion thing might not even be supposed to work, it works, and it works well.  I have it so that the character is always in the middle of the screen, and the tiles are 16x16, so that's what the numbers are for.  map_base is the matrix/2-D array that contains the data for the map.  22 is the number/ID for the tile I'm testing for.  I have 48 and 64 are the coordinates for the initial starting position of the character, since x and y start as 0, even when the character is on the tile located at (64,48).  

Although maybe I could have explained it better, I hope it helps.  :)

kucalc:
Thanks bfr. Is there any side scrolling tutorial out there on the web? If not, than it seems I have to read this book I found in the garage: Action Arcade Adventure kit. It seems pretty good for developing side scrollers.  ;)

Navigation

[0] Message Index

[*] Previous page

Go to full version