Author Topic: Side Scroller  (Read 9737 times)

0 Members and 1 Guest are viewing this topic.

kucalc

  • Guest
Side Scroller
« 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.

Offline trevmeister66

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1009
  • Rating: +14/-5
    • View Profile
Side Scroller
« Reply #1 on: January 31, 2007, 01:44:00 pm »
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.
Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit :)

kucalc

  • Guest
Side Scroller
« Reply #2 on: January 31, 2007, 02:05:00 pm »
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.

Floodkiller

  • Guest
Side Scroller
« Reply #3 on: February 01, 2007, 05:34:00 am »
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.

kucalc

  • Guest
Side Scroller
« Reply #4 on: February 03, 2007, 06:49:00 am »
Thanks Floodkiller, that does help a bit.

kucalc

  • Guest
Side Scroller
« Reply #5 on: February 22, 2007, 07:10:00 pm »
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.

Offline tifreak

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2708
  • Rating: +82/-3
  • My Kung Fu IS strong...
    • View Profile
    • TI-Freakware
Side Scroller
« Reply #6 on: February 23, 2007, 02:33:00 am »
I am glad that you were able to get it figured out. :)smile.gif

I am sorry that we were unable to help, but it seems our C guys have not been on omnimaga for a few days.
Projects: AOD Series: 75% | FFME: 80% | Pokemon: 18% | RPGSK: 60% | Star Trek: 70% | Star Trek 83+: 40% | TI-City: 5%

Offline bfr

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 819
  • Rating: +4/-0
    • View Profile
    • bfr's website
Side Scroller
« Reply #7 on: February 23, 2007, 12:14:00 pm »
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.  :)smile.gif

kucalc

  • Guest
Side Scroller
« Reply #8 on: February 23, 2007, 03:53:00 pm »
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.  ;)wink.gif