Omnimaga
Calculator Community => Casio Calculators => Topic started by: kucalc on January 31, 2007, 01:39:00 pm
-
Hello, I'm wandering if someone can help me. I'm planning on writing the first side-scroller for the Casio fx-9860. Here's what I have:
* My levels are drawn using tiles (8x8 pixels) and the screen resolution is 128x64. The levels are stored within matrices, ex: mat_a[y]
* Since level data are stored within a matrix, how would I keep track of the player's position? Also, how do I "scroll" along a level? Would it be if the player's character reaches halfway across the screen would I increment the x-position?
* Last, how would I draw the level, which is stored using matrices, when scrolling? This is really complicated for me, as I want to scroll pixel-by-pixel instead of block-by-block.
-
hmm well, i don't know casio language at all, but someone else could put it into a TI BASIC language thing first and could explain it to you that way i guess.
-
Psuedo code would be helpful. Also, you can program the fx-9860 in Standard C (most of the standard C functions are supported) + some hardware functions.
-
Well, I know the forumulas you can do (without language info or var info) using a sidescoller that I have:
(position of character in matrix)-((position of character on screen)+(offset of variable according to matrix; this is only to simplify variable counting)) stored into your scrolling variable.
The above is for a block scrolling, however, so you may have to adjust it to a pixel by pixel.
-
Thanks Floodkiller, that does help a bit.
-
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.
-
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.
-
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. :)
-
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. ;)