Author |
Message |
|
Tyler
Advanced Member
Joined: 29 May 2003 Posts: 352
|
Posted: 03 Jul 2003 03:31:03 pm Post subject: |
|
|
I'm really confused about sprites, more about how to move them! This would be a good topic to pin on the top if someone would please describe in detail how to move sprites around the screen! I'm really confused, can someone please write a little snippet with comments? |
|
Back to top |
|
|
james
Member
Joined: 25 May 2003 Posts: 114
|
Posted: 03 Jul 2003 06:48:10 pm Post subject: |
|
|
Okay i will try to describe sprites the best way that i can,even though someone else will have to check what i say to make sure its right.From what i learned there are three basic sizes of sprites(8x8,12x12 and 16x16).There as several commands that are nessary in dealing with sprites..
here are a few..
b=sprite height
a=x coordinate
l=y coordinate
ix->sprite
To put a sprite on a screen you basicly just fill in the above labels.Do u know the ion header,because im teaching this to u in ion. Ill post it anyway.
ION HEADER
.NOLIST
#include "ion.inc"
.LIST
#ifdef TI83P
.org progstart-2
.db $BB,$6D
#else
.org progstart
#endif
ret
jr nc, LoadVars
.db "Sprite",0
END OF CODE
Okay here is a routine to put a sprite on a screen,on points
(0,8)
START OF CODE
Ion header......
ld b,8 ;the sprite is 8 high
ld a,0 ;make register equal zero (0)
ld l,a ;now make register l equal (0)
ld ix,sprite ;load the sprite into register ix
call ionPutSprite ;call the library
bcall(_grbufcpy) ;copy the graph buffer to the screen-- ;displays the sprite!
bcall(_getkey) ;pause until key pressed
ret ;return to ION
sprite:
.db %00111100
.db %01000010
.db %10001001
.db %10000101
.db %10000001
.db %10000001
.db %01000010
.db %00111100
.end
END
END OF CODE
As u can see this puts a shiney ball at (0,
I hope this helps you,as far as moving sprites,we will go over that after you have learned how to put sprites all over the screen.But if u can figure it out...all you have to do to move the sprite is have a getkey routine,and after the key is pressed than load the sprite into a register and increase or decrease the register depending on what direction u want the sprite to move..
Note this info was not produced to be...
Information gathered from IG by Matthew Hernandez
james |
|
Back to top |
|
|
Justin W. Shattered Silence
Advanced Member
Joined: 24 May 2003 Posts: 429
|
Posted: 03 Jul 2003 07:06:05 pm Post subject: |
|
|
In order to move the sprite you must store it's coordinates in temporary variables, or something of the same likeness. The Ion routine that James specified above is an xor routine so you would need to call the routine then call IonFastCopy then call the sprite again so as to erase it from the buffer before the next movement. If you do not wish to use Ion and rather no-shell asm I can post the source for one of my sprite routines. I assume you want to be able to move the sprite one pixel at a time so I will have to give you an unaligned sprite. Aligned means it's coordinates are a multiple of 8 and takes alot less code but you will only be able to move the sprite right or left 8 pixels at a time. Unaligned simply means that it's coordinates will be able to be specified in terms of 0-88 (for an 8 pixel wide sprite). Also how big would you like the sprites to be? So i know how to modify my routine for your purposes because as of now it's designed for 8*8 sprites.
Also James, a sprite can be as big as you like. The one's you listed except for 12*12, are just the simpler ones. A good asm coder can make a sprite routine to serve any of their purposes. |
|
Back to top |
|
|
james
Member
Joined: 25 May 2003 Posts: 114
|
Posted: 03 Jul 2003 08:28:22 pm Post subject: |
|
|
I know,thx,but i was just trying to teach the basics of the sprite and how it functions. If he want s the source in ion i will be able to give him one of my routines if he wants. But my sprites do not have the smooth walking animation,they just move inc or dec. But i will ask how to do that later,or u can just aim me justin,whatever u want
thx for the backup |
|
Back to top |
|
|
james
Member
Joined: 25 May 2003 Posts: 114
|
Posted: 03 Jul 2003 08:31:32 pm Post subject: |
|
|
Lol, i was just thing im james w and your justin w,and my brothers name is justin tooo. i just thought that was funny.also we are both in super mode.If i was a dbz character i would prob be piccolo the strong silent type,with witsss,or vegeta the battle specialist,but hes ruthless
i dont know where this is comming from,back to the topic at hand...
james |
|
Back to top |
|
|
Justin W. Shattered Silence
Advanced Member
Joined: 24 May 2003 Posts: 429
|
Posted: 03 Jul 2003 10:38:42 pm Post subject: |
|
|
james wrote: I know,thx,but i was just trying to teach the basics of the sprite and how it functions. If he want s the source in ion i will be able to give him one of my routines if he wants. But my sprites do not have the smooth walking animation,they just move inc or dec. But i will ask how to do that later,or u can just aim me justin,whatever u want
thx for the backup
And I was giving my personal perspective as I have a large knowledge in the sprites department. |
|
Back to top |
|
|
Tyler
Advanced Member
Joined: 29 May 2003 Posts: 352
|
Posted: 04 Jul 2003 10:04:22 am Post subject: |
|
|
I forgot to mention I was sort of looking for native hex, not ion routines because i want to make nostub programs, so Justin could you please post that snippet. (In the meantime i've been moving pixels! Yeah!! lol) :lol:
Edited post - And thats not working too well either stupid me!
Last edited by Guest on 04 Jul 2003 10:09:03 am; edited 1 time in total |
|
Back to top |
|
|
Justin W. Shattered Silence
Advanced Member
Joined: 24 May 2003 Posts: 429
|
Posted: 05 Jul 2003 12:19:51 am Post subject: |
|
|
Well the Ion routines are able to be used with normal asm programs but the routine must be modified slightly. Do you want a multi width multi height sprite routine or is there a specific size you want? |
|
Back to top |
|
|
Tyler
Advanced Member
Joined: 29 May 2003 Posts: 352
|
Posted: 05 Jul 2003 03:19:24 pm Post subject: |
|
|
I'm sorta looking for just 8x8 and 16x16 sprites in nostub asm. Thanks in advance! |
|
Back to top |
|
|
Tyler
Advanced Member
Joined: 29 May 2003 Posts: 352
|
Posted: 05 Jul 2003 08:58:17 pm Post subject: |
|
|
Oh yeah, and I got the pixel program to work |
|
Back to top |
|
|
Justin W. Shattered Silence
Advanced Member
Joined: 24 May 2003 Posts: 429
|
Posted: 06 Jul 2003 01:35:08 am Post subject: |
|
|
Well here's an 8*8 aligned sprite routine
;inputs : a=xcoordinate (0-11) l=ycoordinate(0-56) ix=sprite pointer
put8by8:
ld e,l
ld h,0
ld d,h
add hl,de
add hl,de
add hl,hl
add hl,hl
ld e,a
add hl,de
ld de,plotsscreen
add hl,de
ld b,8
put8by8loop:
ld a,(ix)
xor (hl)
inc ix
ld de,12
add hl,de
djnz put8by8loop
ret
Last edited by Guest on 06 Jul 2003 01:36:09 am; edited 1 time in total |
|
Back to top |
|
|
Adm.Wiggin aka Tianon
Know-It-All
Joined: 02 Jun 2003 Posts: 1874
|
Posted: 07 Jul 2003 01:38:49 pm Post subject: |
|
|
oh, justin, just an fyi, in my WALLSxp shell (in development!) i used one of your masked sprite routines from cirrus... i just edited one line, and it worked fine! |
|
Back to top |
|
|
Tyler
Advanced Member
Joined: 29 May 2003 Posts: 352
|
Posted: 07 Jul 2003 04:58:15 pm Post subject: |
|
|
Whats wrong with this code? It runs ok, but dosen't display anything, i've tried screen clears, and getkeys, but nothing seems to display it. The funny thing is it dosen't crash!
;Mouse Sprite Testing...
#include "ti83plus.inc" ;File needed to access system routines
.org userMem-2 ;Define where to start in memory
.db $BB,$6D ;AsmPrgm instruction
bcall(_clrLCDfull)
ld a,2
ld l,2
ld ix,mouse1
ld e,l
ld h,0
ld d,h
add hl,de
add hl,de
add hl,hl
add hl,hl
ld e,a
add hl,de
ld de,plotsscreen
add hl,de
ld b,8
put8by8loop:
ld a,(ix)
xor (hl)
inc ix
ld de,12
add hl,de
djnz put8by8loop
bcall(_getKey)
ret ;Exit program
mouse1:
.db %10000000
.db %11100000
.db %11111000
.db %11111100
.db %11111110
.db %00010000
.db %00011000
.db %00001000
.end ;End of code |
|
Back to top |
|
|
Adm.Wiggin aka Tianon
Know-It-All
Joined: 02 Jun 2003 Posts: 1874
|
Posted: 07 Jul 2003 05:02:26 pm Post subject: |
|
|
just an fyi, put ur code in code bracets, then it allows for extra spaces! u could also do ascii art that way... |
|
Back to top |
|
|
John Barrus
Member
Joined: 25 May 2003 Posts: 131
|
Posted: 07 Jul 2003 06:45:46 pm Post subject: |
|
|
Simple, just copy the buffer to the graphscreen. bcall(_grbufcpy) |
|
Back to top |
|
|
Justin W. Shattered Silence
Advanced Member
Joined: 24 May 2003 Posts: 429
|
Posted: 07 Jul 2003 08:00:39 pm Post subject: |
|
|
Yes all you need to do is copy the buffer to the lcd using the command John pointed out above.
Adm. Wiggin. I do not mind that you used my routine but if it is going to be released I do ask that you give credit where it is due. |
|
Back to top |
|
|
Tyler
Advanced Member
Joined: 29 May 2003 Posts: 352
|
Posted: 08 Jul 2003 06:44:21 am Post subject: |
|
|
It must be me, this is getting so frusturating! It's probabily just me again putting the grBufCpy in the wrong place, but could you guys give it one last look? Thanks!
Code: ;Mouse Sprite Testing...
#include "ti83plus.inc";File needed to access system routines
.org userMem-2;Define where to start in memory
.db $BB,$6D;AsmPrgm instruction
bcall(_clrLCDfull)
ld a,2
ld l,2
ld ix,mouse1
ld e,l
ld h,0
ld d,h
add hl,de
add hl,de
add hl,hl
add hl,hl
ld e,a
add hl,de
ld de,plotsscreen
add hl,de
ld b,8
put8by8loop:
ld a,(ix)
xor (hl)
inc ix
ld de,12
add hl,de
djnz put8by8loop
bcall(_grbufcpy)
bcall(_getKey)
ret;Exit program
mouse1:
.db %10000000
.db %11100000
.db %11111000
.db %11111100
.db %11111110
.db %00010000
.db %00011000
.db %00001000
.end;End of code
|
|
Back to top |
|
|
Adm.Wiggin aka Tianon
Know-It-All
Joined: 02 Jun 2003 Posts: 1874
|
Posted: 08 Jul 2003 02:15:53 pm Post subject: |
|
|
ur _GrBufCopy is in the right spot... i dunno why it wont work!
Justin W. : if u would look at the asm forum topic WALLSxp, then u would notice, that the credits have ur name in them! just thought u aut to know! |
|
Back to top |
|
|
Job the GameQuitter
Member
Joined: 04 Jun 2003 Posts: 102
|
Posted: 08 Jul 2003 06:44:08 pm Post subject: |
|
|
I don't see anything wrong with it either - aside from the fact that you put [font="Arial"]LD DE,12 inside the [font="Arial"]put8by8loop while you should have put it in front of it. Saves about 70 cycles. |
|
Back to top |
|
|
JacobdeHaan
Member
Joined: 10 Jul 2003 Posts: 165
|
Posted: 10 Jul 2003 05:03:51 am Post subject: |
|
|
I compiled and ran your source, and I experienced the exact same thing. I ran fine, nothing showed up, and when I thouched a button, the graph came up, quitting the program without any crashes. |
|
Back to top |
|
|
|