Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
About
Team
Rules
Stats
Status
Sitemap
Chat
Downloads
Forum
News
Our Projects
Major Community Projects
Recent Posts
Unread Posts
Replies
Tools
SourceCoder3
Other Things...
Omnimaga Radio
TI-83 Plus ASM File Unsquisher
Z80 Conversion Tools
IES TI File Editor
Free RAM areas
Comprehensive Getkeyr table
URL Shortener
Online Axe Tilemap Editor
Help
Contact Us
Change Request
Report Issue/Bug
Team
Articles
Members
View the memberlist
Search For Members
Buddies
Login
Register
Omnimaga
»
Forum
»
Calculator Community
»
TI Calculators
»
TI-BASIC
»
Sprite Masking
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: Sprite Masking (Read 2987 times)
0 Members and 1 Guest are viewing this topic.
trevmeister66
LV9
Veteran (Next: 1337)
Posts: 1009
Rating: +14/-5
Sprite Masking
«
on:
April 17, 2007, 03:51:00 pm »
I was wondering if anybody could give me a crash corse on sprite masking and give some example code. This is going to be used with XLIB, so don't use any asm jargon, unless you need to
.
Logged
Projects: nameless RPG: 1.0% |
Reverse Snake v1.5:
100% | Secret Project: 5% | DUNGEON: 70%
My
MW2 Blog
<-- Please visit
Jon
LV5
Advanced (Next: 300)
Posts: 278
Rating: +0/-0
Sprite Masking
«
Reply #1 on:
April 17, 2007, 04:36:00 pm »
I can't help you as far as code goes, i don't know basic worth beans, but i can explain the general point of masking. What it does is it plots a sprite on the screen, preserving the background. The point of a mask is to remove the background where the sprite will be placed, but preserve it everywhere else.
Here is an example of an 8x8 sprite and its mask:
sprite:
.db %00000000
,db %00111100
.db %01000010
.db %01000010
.db %01000010
.db %01000010
.db %00111100
.db %00000000
spritemask:
.db %11111111
.db %11000011
.db %10000001
.db %10000001
.db %10000001
.db %10000001
.db %11000011
.db %11111111
So the mask is plotted using AND logic, meaning all the 0's in the mask will erase the corresponding pixels, and 1's will leave the pixels as they were before. Then the sprite is plotted on top of that using OR logic, meaning all the 0's in the sprite will leave the previous image unchanged, and all the 1's will translate to black pixels. If you were to just use OR logic, without masking, the background would be preserved around the sprite, but the sprite itself would look funky.
Logged
trevmeister66
LV9
Veteran (Next: 1337)
Posts: 1009
Rating: +14/-5
Sprite Masking
«
Reply #2 on:
April 20, 2007, 07:18:00 pm »
mk, im starting to somewhat understand it. Thanks alot for ur help.
Logged
Projects: nameless RPG: 1.0% |
Reverse Snake v1.5:
100% | Secret Project: 5% | DUNGEON: 70%
My
MW2 Blog
<-- Please visit
Halifax
LV9
Veteran (Next: 1337)
Posts: 1334
Rating: +2/-1
Sprite Masking
«
Reply #3 on:
April 20, 2007, 07:50:00 pm »
QuoteBegin-Jon+17 Apr, 2007, 22:36-->
QUOTE
(Jon @ 17 Apr, 2007, 22:36)
I can't help you as far as code goes, i don't know basic worth beans, but i can explain the general point of masking. What it does is it plots a sprite on the screen, preserving the background. The point of a mask is to remove the background where the sprite will be placed, but preserve it everywhere else.
Here is an example of an 8x8 sprite and its mask:
sprite:
.db %00000000
,db %00111100
.db %01000010
.db %01000010
.db %01000010
.db %01000010
.db %00111100
.db %00000000
spritemask:
.db %11111111
.db %11000011
.db %10000001
.db %10000001
.db %10000001
.db %10000001
.db %11000011
.db %11111111
So the mask is plotted using AND logic, meaning all the 0's in the mask will erase the corresponding pixels, and 1's will leave the pixels as they were before. Then the sprite is plotted on top of that using OR logic, meaning all the 0's in the sprite will leave the previous image unchanged, and all the 1's will translate to black pixels. If you were to just use OR logic, without masking, the background would be preserved around the sprite, but the sprite itself would look funky.
You always were the master at masking(in my eyes haha). At least you taught me how too. :thumbup:
Logged
There are 10 types of people in this world-- those that can read binary, and those that can't.
Jon
LV5
Advanced (Next: 300)
Posts: 278
Rating: +0/-0
Sprite Masking
«
Reply #4 on:
April 21, 2007, 04:00:00 pm »
Thx, I'll make sure to find my way back to psugen when i get more free time
Logged
dinhotheone
LV6
Super Member (Next: 500)
Posts: 410
Rating: +2/-1
Sprite Masking
«
Reply #5 on:
April 25, 2007, 01:09:00 pm »
well i cant really give you any code but basically (assuming you have no clue what it is) you create sort of a cutout of the sprite where the body of where your sprite would be is white and the rest is black. then AND that onto the screen after the backround, this clears all the pxl's inside the body of the sprite. then just OR the actual sprite on and you are good to go.
...i CAN give you a program with basic masking and little else but i have no clue how get that to you. wait no i see it, leme get it up for you.
edit: it was in a group in my calc, sorry about being lazy (i left the other progs with it), it uses xlib, just run "sprite" (assuming you have xlib) and select the first option and your good to go. Also feel free to use anything in that package. its all pretty mundane and i'd rather it be put to use by someone than let it stew on my calc.
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
Omnimaga
»
Forum
»
Calculator Community
»
TI Calculators
»
TI-BASIC
»
Sprite Masking