This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's z80 & ez80 Assembly subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Z80 & 68k Assembly => z80 & ez80 Assembly
Author Message
MaxVT103


Member


Joined: 24 Aug 2003
Posts: 109

Posted: 16 Nov 2003 03:59:51 pm    Post subject:

The advantage of using both virtical and side scrolling comes when you come to blocks or something that goes above the screen. If you've played mario on the 89 you'l understand this bc when you go up a little ways or press up you can see whats above you on the screen that wouldn't be visible normaly.
Back to top
DigiTan
Unregistered HyperCam 2


Super Elite (Last Title)


Joined: 10 Nov 2003
Posts: 4468

Posted: 17 Nov 2003 09:56:39 pm    Post subject:

Quote:
ah alright, but if my game is just a side scroller I wouldn't need the vertical stuff right?
Digitan could you explain how you got those numbers?

Mostly everything is included in the Tilemap v3.0 documentation.

The key to using Tilemap v3.0 is to think of SSY, SOY, SSX, and SOX as "coordinates", like on a map. Since we won't use verticle scrolling, we can totally ignore SSY and SOY and set them both equal to zero:

Code:
xor a; Same as "ld a,0" but faster and smaller
ld (ssy),a; These will be 0
ld (soy),a;


Since most side-scrollers start you out on the left part of each level, we'll start by setting SSX and SOX to display the leftmost part of the map. SSX=0 SOX=0

Code:
xor a
ld (ssx),a   ; Tile offset is 0
ld (sox),a   ; Pixel offset is 0
call render_map; Draw the tilemap

And this is what you would see...

---------------------------------
Next, we can move over 1 whole tile by setting SSX=1. We can leave SOX at zero.

Code:
ld a,1
ld (ssx),a   ; Tile offset is 1
   ; Pixel offset is still 0
call render_map; Draw the tilemap

And this is what you would see...

(Notice that the right side is totally blank. This happened because my map is only 1 screen wide and wasn't designed to scroll. Strange things can happen if you scroll out of your tilemap, so be careful! Very Happy )
---------------------------------
Finally, I'll move over 1 pixel by setting SOX=1. We'll leave SSX at 1.

Code:
ld a,1
ld (sox),a   ; Pixel offset is 1
  ; Tile offset is still 1
call render_map   ; Draw the tilemap

And this is what you would see...

---------------------------------

To smooth scroll right, you'll have to make a loop where SOX (pixel) goes from 0-7. Then, instead of letting SOX reach 8, you should "inc" SSX and then set SOX to 0. Usually, if the pixel offset (SOX) is 8 or more, you'll get a graphics bug somewhere on your screen (though, I think CrASH_Man put in some safeguards to prevent bugs).
Back to top
tr1p1ea


Elite


Joined: 03 Aug 2003
Posts: 870

Posted: 18 Nov 2003 10:45:38 am    Post subject:

OK making people jump the 'correct looking' way is actually very simple.

Acceleration = Constant
Velocity = Velocity + Acceleration
Position = Position + Velocity

To make something 'jump' just set 'Velocity' to -10 or something(you have to play aropund with this value) Very Happy.

I could code a small demo for you if you want........?


Last edited by Guest on 18 Nov 2003 11:20:56 am; edited 1 time in total
Back to top
tr1p1ea


Elite


Joined: 03 Aug 2003
Posts: 870

Posted: 18 Nov 2003 11:16:42 am    Post subject:

OK here is a small Demo (ion):


Code:
.nolist     
#include "ion.inc"
.list

#ifdef TI83P
        .org    progstart-2
        .db     $BB,$6D
#else
        .org    progstart
#endif
        ret    
        jr      nc,begin

        .db     "Jump Test",0   
begin:

ResetSpr:
        xor a
        ld (JumpingQ),a

        ld a,44
        ld (SprX),a
        ld a,48
        ld (SprY),a

        ld a,1
        ld (Acc),a
        ld a,-7
        ld (Vel),a
        ld a,48
        ld (Pos),a
Main:   
        call DrawSpr
        call Delay
        ld a,0FFh
        out (1),a
        ld a,0FDh
        out (1),a
        in a,(1)
        cp 191
        jp z,Quit

        ld a,(JumpingQ)
        or a
        jp nz,Jump

        ld a,0FFh
        out (1),a
        ld a,0BFh
        out (1),a
        in a,(1)
        cp 223
        jp z,Jump
        jp Main

Jump:
        ld a,1
        ld (JumpingQ),a

        ld a,(Vel)
        cp 6
        jp z,ResetSpr
        ld c,a
        ld a,(Acc)
        add a,c
        ld (Vel),a
        ld c,a
        ld a,(Pos)
        add a,c
        ld (Pos),a
        ld (SprY),a
        jp Main

DrawSpr
        call _grBufClr
        ld b,8
        ld a,(SprY)
        ld l,a
        ld a,(SprX)
        ld ix,Spr
        call ionPutSprite
        call ionFastCopy
        ret

Delay:
        ld a,140
        ld c,a
DelayLoop1:
        ld d,a
DelayLoop2:
        dec d
        jp nz,DelayLoop2
        dec c
        jp nz,DelayLoop1
        ret

Quit:
        call _clrlcdfull
        ret

SprX:
        .db 0
SprY:
        .db 0

Acc:
        .db 0
Vel:
        .db 0
Pos:
        .db 0

JumpingQ:
        .db 0

Spr:
        .db $00,$85,$87,$87,$FF,$7E,$A5,$A5

.end
END


The Result:

*Looks smoother on-calc ..... and please excuse the crude sprite 'Me0w' Smile.

Hopefully it is easy enough to understand (i tried to make it as simple as i could). The delay is so you can see how it increments, as it is way too fast without it.

The theory is the same as my above post ....

Hope it helps Very Happy.


Last edited by Guest on 19 Nov 2003 02:34:24 am; edited 1 time in total
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    » Goto page Previous  1, 2
» View previous topic :: View next topic  
Page 2 of 2 » All times are UTC - 5 Hours

 

Advertisement