[A83] Re: Tilemap
[Prev][Next][Index][Thread]
[A83] Re: Tilemap
I take it that none of you read what David Phillips had to say this weekend
about doing things for yourself.
The easiest way that I animate tiles is to have a variable that increments
every time the tilemap is redrawn. Depending on how frequently this is done
you may have to animate every 2,4 or 8 times the tilemap is called. This
controls the animation.
Here is a very brief example (from inside your tilemap routine). The code
is sloppy. It can be optimized. Do not reply to show any optimizations.
; start generic tilemap code
; tile # you want to draw is located at HL
ld a,(animationTimer) ; I would suggest that the timer be shifted (rather
than the tile ID), because you might not want to use a "good" number like 8
for your number of frames.
ld b,a
sla b
sla b
sla b ; shift it 3 bits (allow space for the 3 bits to identify
the tile)
ld a,(HL) ; get tile #
and 111b ; we only care about bottom 3 bits. assume there are only 8
tiles in use
OR B ; combine the two
push hl
ld hl,sprites ; sprite start
ld b,0
ld c,a ; set 16 bit reg for addition
add hl,bc ; at correct location for start of sprite
; draw sprite located at HL
pop hl
; more generic tilemap code
sprites:
db 0,0,0,0,0,0,0,0 ; tile 0, frame 0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0 ; tile 7, frame 0
db 255,0,0,0,255,0,0,0 ; tile 0, frame 1
; etc.
----- Original Message -----
From: "Nick Palladino" <nickps1@hotmail.com>
To: <assembly-83@lists.ticalc.org>
Sent: Tuesday, October 16, 2001 7:35 PM
Subject: [A83] Re: Tilemap
>
> Also could anyone tell me how to animate tiles in a tilemap with some
> example code, Thanks
>
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
>
>
>
References: