Author Topic: sprite question  (Read 7086 times)

0 Members and 1 Guest are viewing this topic.

Offline Snake X

  • Ancient Veteran
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 810
  • Rating: +33/-8
    • View Profile
sprite question
« on: June 09, 2010, 10:15:56 am »
how many hex values can be stores in pic0-9 at max?
For example: [28937A3847FDAA137139B1478247E82671]->pic1
Loved this place, still the best producers of power metal, and sparked my dreams of coding.

SirCmpwn

  • Guest
Re: sprite question
« Reply #1 on: June 09, 2010, 10:30:09 am »
Depends on your free RAM.  These values are simply appended to the end of the binary, and you can store as much data as you have RAM to hold it.  Personally, I use newlines and new brackets to keep things organized, but you should be able to use as much as you like.  While I was working on HL2, I had 1536 digits of hex in a single set of brackets [].

Offline jsj795

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1105
  • Rating: +84/-3
    • View Profile
Re: sprite question
« Reply #2 on: June 09, 2010, 10:50:59 am »
I have a sprite question too... For 5x5 sprites sheet, do you still need to put in hex code for 8x8 sprites?
So it would go like,
[8x8 sprite 1 ->Pic1
[8x8 sprite 2
[8x8 sprite 3

etc.?


Spoiler For funny life mathematics:
1. ROMANCE MATHEMATICS
Smart man + smart woman = romance
Smart man + dumb woman = affair
Dumb man + smart woman = marriage
Dumb man + dumb woman = pregnancy
2. OFFICE ARITHMETIC
Smart boss + smart employee = profit
Smart boss + dumb employee = production
Dumb boss + smart employee = promotion
Dumb boss + dumb employee = overtime
3. SHOPPING MATH
A man will pay $2 for a $1 item he needs.
A woman will pay $1 for a $2 item that she doesn't need.
4. GENERAL EQUATIONS & STATISTICS
A woman worries about the future until she gets a husband.
A man never worries about the future until he gets a wife.
A successful man is one who makes more money than his wife can spend.
A successful woman is one who can find such a man.
5. HAPPINESS
To be happy with a man, you must understand him a lot and love him a little.
To be happy with a woman, you must love her a lot and not try to understand her at all.
6. LONGEVITY
Married men live longer than single men do, but married men are a lot more willing to die.
7. PROPENSITY TO CHANGE
A woman marries a man expecting he will change, but he doesn't.
A man marries a woman expecting that she won't change, and she does.
8. DISCUSSION TECHNIQUE
A woman has the last word in any argument.
Anything a man says after that is the beginning of a new argument.

Girls = Time * Money (Girls are a combination of time and money)
Time = Money (Time is money)
Girls = Money squared (So, girls are money squared)
Money = sqrt(Evil) (Money is also the root of all evil)
Girls = sqrt(Evil) squared (So, girls are the root of all evil squared)
Girls = Evil (Thus, girls are evil)
*Girls=Evil credit goes to Compynerd255*

SirCmpwn

  • Guest
Re: sprite question
« Reply #3 on: June 09, 2010, 11:20:04 am »
Yes.  You could technically combine them using partial bytes and a 5 bit system, but this is a hell of a lot more trouble than it is worth.  Just put each 5x5 sprite into your program the same way you would use an 8x8 sprite.  You should be aware, though, that Pt-Off will clear an 8x8 area around your sprite, not 5x5.

Offline jsj795

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1105
  • Rating: +84/-3
    • View Profile
Re: sprite question
« Reply #4 on: June 09, 2010, 12:52:11 pm »
so what should i do to clear the sprite? well, my sprite is 7x5 not 5x5, it's the tile that's 5x5...
anyways, how can i clear only sprite and not the whole 8x8 tile


Spoiler For funny life mathematics:
1. ROMANCE MATHEMATICS
Smart man + smart woman = romance
Smart man + dumb woman = affair
Dumb man + smart woman = marriage
Dumb man + dumb woman = pregnancy
2. OFFICE ARITHMETIC
Smart boss + smart employee = profit
Smart boss + dumb employee = production
Dumb boss + smart employee = promotion
Dumb boss + dumb employee = overtime
3. SHOPPING MATH
A man will pay $2 for a $1 item he needs.
A woman will pay $1 for a $2 item that she doesn't need.
4. GENERAL EQUATIONS & STATISTICS
A woman worries about the future until she gets a husband.
A man never worries about the future until he gets a wife.
A successful man is one who makes more money than his wife can spend.
A successful woman is one who can find such a man.
5. HAPPINESS
To be happy with a man, you must understand him a lot and love him a little.
To be happy with a woman, you must love her a lot and not try to understand her at all.
6. LONGEVITY
Married men live longer than single men do, but married men are a lot more willing to die.
7. PROPENSITY TO CHANGE
A woman marries a man expecting he will change, but he doesn't.
A man marries a woman expecting that she won't change, and she does.
8. DISCUSSION TECHNIQUE
A woman has the last word in any argument.
Anything a man says after that is the beginning of a new argument.

Girls = Time * Money (Girls are a combination of time and money)
Time = Money (Time is money)
Girls = Money squared (So, girls are money squared)
Money = sqrt(Evil) (Money is also the root of all evil)
Girls = sqrt(Evil) squared (So, girls are the root of all evil squared)
Girls = Evil (Thus, girls are evil)
*Girls=Evil credit goes to Compynerd255*

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: sprite question
« Reply #5 on: June 09, 2010, 12:55:18 pm »
I generally separate my brackets depending of the type of sprite/tiles I have stored. I'll put player sprites in one set, enemies in another set of brackets and tiles in another, for example.

SirCmpwn

  • Guest
Re: sprite question
« Reply #6 on: June 09, 2010, 12:56:26 pm »
Pt-Change( will clear it.  Alternitavely, redraw every sprite each frame, that's what I do.
Also, have a 5x5 black square sprite and call Pt-On( with the square sprite to clear it to black, and Pt-Change( with the square sprite in the same spot to clear it to white.
« Last Edit: June 09, 2010, 12:57:28 pm by Mr_Coding_Knight »

Offline jsj795

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1105
  • Rating: +84/-3
    • View Profile
Re: sprite question
« Reply #7 on: June 09, 2010, 12:58:54 pm »
I think I'll do the Pt-Change(
That seems to be easiest. So that won't clear the tiles and only clear the sprite, right?

@DJ yeah that's what I do. I keep the tilesheet in one pic, character in another pic.

MY 666 POST!!!


Spoiler For funny life mathematics:
1. ROMANCE MATHEMATICS
Smart man + smart woman = romance
Smart man + dumb woman = affair
Dumb man + smart woman = marriage
Dumb man + dumb woman = pregnancy
2. OFFICE ARITHMETIC
Smart boss + smart employee = profit
Smart boss + dumb employee = production
Dumb boss + smart employee = promotion
Dumb boss + dumb employee = overtime
3. SHOPPING MATH
A man will pay $2 for a $1 item he needs.
A woman will pay $1 for a $2 item that she doesn't need.
4. GENERAL EQUATIONS & STATISTICS
A woman worries about the future until she gets a husband.
A man never worries about the future until he gets a wife.
A successful man is one who makes more money than his wife can spend.
A successful woman is one who can find such a man.
5. HAPPINESS
To be happy with a man, you must understand him a lot and love him a little.
To be happy with a woman, you must love her a lot and not try to understand her at all.
6. LONGEVITY
Married men live longer than single men do, but married men are a lot more willing to die.
7. PROPENSITY TO CHANGE
A woman marries a man expecting he will change, but he doesn't.
A man marries a woman expecting that she won't change, and she does.
8. DISCUSSION TECHNIQUE
A woman has the last word in any argument.
Anything a man says after that is the beginning of a new argument.

Girls = Time * Money (Girls are a combination of time and money)
Time = Money (Time is money)
Girls = Money squared (So, girls are money squared)
Money = sqrt(Evil) (Money is also the root of all evil)
Girls = sqrt(Evil) squared (So, girls are the root of all evil squared)
Girls = Evil (Thus, girls are evil)
*Girls=Evil credit goes to Compynerd255*

SirCmpwn

  • Guest
Re: sprite question
« Reply #8 on: June 09, 2010, 01:01:02 pm »
Pt-Change will invert the sprite.  To clear a 5x5 sprite to white, do this:
Code: [Select]
[1F1F1F1F1F000000->Pic1
...
Pt-On(X,Y,Pic1
Pt-Change(X,Y,Pic1
This will only affect a 5x5 area, and will make it white.

(My 700th post)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: sprite question
« Reply #9 on: June 09, 2010, 01:03:05 pm »
Thanks for the tip Sir. I assume that if your terrain isn't all plain white, that the usage of masked sprites is inevitable, though, right?

And congrats jsj795 for turning evil :P
« Last Edit: June 09, 2010, 01:03:47 pm by DJ Omnimaga »

SirCmpwn

  • Guest
Re: sprite question
« Reply #10 on: June 09, 2010, 01:05:00 pm »
It depends.  The tile mapper should clear the screen before drawing the map, anyway.  However, the sprites on top should be maksed.  But it's not that hard to mask sprites, just do Pt-On with a filled sprite and Pt-Change with the stuff you want to clear off.

Offline jsj795

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1105
  • Rating: +84/-3
    • View Profile
Re: sprite question
« Reply #11 on: June 09, 2010, 01:05:10 pm »
I think what Pt-Change will do is to invert all the pixels that your character has, and leave the white pixels in the 8x8 sprite alone, which means even if the terrain is black, you still will have black. So no need to mask (or at least that's how I understood)

Edit: ninja'd and kind of wrong info too :P lol
« Last Edit: June 09, 2010, 01:05:39 pm by jsj795 »


Spoiler For funny life mathematics:
1. ROMANCE MATHEMATICS
Smart man + smart woman = romance
Smart man + dumb woman = affair
Dumb man + smart woman = marriage
Dumb man + dumb woman = pregnancy
2. OFFICE ARITHMETIC
Smart boss + smart employee = profit
Smart boss + dumb employee = production
Dumb boss + smart employee = promotion
Dumb boss + dumb employee = overtime
3. SHOPPING MATH
A man will pay $2 for a $1 item he needs.
A woman will pay $1 for a $2 item that she doesn't need.
4. GENERAL EQUATIONS & STATISTICS
A woman worries about the future until she gets a husband.
A man never worries about the future until he gets a wife.
A successful man is one who makes more money than his wife can spend.
A successful woman is one who can find such a man.
5. HAPPINESS
To be happy with a man, you must understand him a lot and love him a little.
To be happy with a woman, you must love her a lot and not try to understand her at all.
6. LONGEVITY
Married men live longer than single men do, but married men are a lot more willing to die.
7. PROPENSITY TO CHANGE
A woman marries a man expecting he will change, but he doesn't.
A man marries a woman expecting that she won't change, and she does.
8. DISCUSSION TECHNIQUE
A woman has the last word in any argument.
Anything a man says after that is the beginning of a new argument.

Girls = Time * Money (Girls are a combination of time and money)
Time = Money (Time is money)
Girls = Money squared (So, girls are money squared)
Money = sqrt(Evil) (Money is also the root of all evil)
Girls = sqrt(Evil) squared (So, girls are the root of all evil squared)
Girls = Evil (Thus, girls are evil)
*Girls=Evil credit goes to Compynerd255*

SirCmpwn

  • Guest
Re: sprite question
« Reply #12 on: June 09, 2010, 01:07:23 pm »
Um, I'm not entirely following you here...
Pt-On will turn on the pixels in your sprite, and leave the rest alone.
Pt-Off will overwrite the screen pixels with your own pixels, which will turn off the zeros and turn on the ones.
Pt-Change will change pixels on the screen.  If a pixel in your sprite is black and a pixel on screen is white, the on screen pixel becomes black.  If a pixel in your sprite is black and the pixel on screen is black, the pixel on screen becomes white.

Offline jsj795

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1105
  • Rating: +84/-3
    • View Profile
Re: sprite question
« Reply #13 on: June 09, 2010, 01:11:40 pm »
So if I do a Pt-On(5x7 Sprite
and then I do a Pt-Change(5x7 Sprite (the same one that I did with Pt-On)
then nothing will be disrupted except my 5x7 will be erased, right?


Spoiler For funny life mathematics:
1. ROMANCE MATHEMATICS
Smart man + smart woman = romance
Smart man + dumb woman = affair
Dumb man + smart woman = marriage
Dumb man + dumb woman = pregnancy
2. OFFICE ARITHMETIC
Smart boss + smart employee = profit
Smart boss + dumb employee = production
Dumb boss + smart employee = promotion
Dumb boss + dumb employee = overtime
3. SHOPPING MATH
A man will pay $2 for a $1 item he needs.
A woman will pay $1 for a $2 item that she doesn't need.
4. GENERAL EQUATIONS & STATISTICS
A woman worries about the future until she gets a husband.
A man never worries about the future until he gets a wife.
A successful man is one who makes more money than his wife can spend.
A successful woman is one who can find such a man.
5. HAPPINESS
To be happy with a man, you must understand him a lot and love him a little.
To be happy with a woman, you must love her a lot and not try to understand her at all.
6. LONGEVITY
Married men live longer than single men do, but married men are a lot more willing to die.
7. PROPENSITY TO CHANGE
A woman marries a man expecting he will change, but he doesn't.
A man marries a woman expecting that she won't change, and she does.
8. DISCUSSION TECHNIQUE
A woman has the last word in any argument.
Anything a man says after that is the beginning of a new argument.

Girls = Time * Money (Girls are a combination of time and money)
Time = Money (Time is money)
Girls = Money squared (So, girls are money squared)
Money = sqrt(Evil) (Money is also the root of all evil)
Girls = sqrt(Evil) squared (So, girls are the root of all evil squared)
Girls = Evil (Thus, girls are evil)
*Girls=Evil credit goes to Compynerd255*

SirCmpwn

  • Guest
Re: sprite question
« Reply #14 on: June 09, 2010, 01:12:17 pm »
Right.