I've decided to direct all of my Prizm C questions here in this topic, so I don't have to go back to other topics to ask questions. So here's my first question:

How do I make animated sprites?
You store different frames of your animated sprites as different sprites, then draw over them when you want to move to the next frame.
That makes sense. Thanks!
You'd draw different sprites per frame, from a list of sprites. For example, let's say you have four 24*24 sprites, all in order in the data.h file, and you wanted to draw a different one per frame, you would have a "frames" int variable that would increase each frame, and draw the sprite like this:


Code:
CopySprite(frames%4*24*24+(color_t*)first_sprite, x, y, 24, 24);
Okay, so I'm make a lame little portal type test thing. It's not 3D, so do get any hopes up. Like I said, it's lame. Well, I'm having problems dropping the portals.


Code:
#include "keyboard.hpp"   
#include "color.h"   
#include "display.h"   
#include "keyboard_syscalls.h"   
#include "PortalPics.h"

void CopySprite(const void* datar, int x, int y, int width, int height) {     
   color_t*data = (color_t*) datar;     
   color_t* VRAM = (color_t*)0xA8000000;     
   VRAM += LCD_WIDTH_PX*y + x;     
   for(int j=y; j<y+height; j++) {     
      for(int i=x; i<x+width; i++) {     
         *(VRAM++) = *(data++);     
     }     
     VRAM += LCD_WIDTH_PX-width;     
   }     
}   

void CopySpriteMasked(const void*datar, int x, int y, int width, int height, int maskcolor) {
   color_t*data = (color_t*) datar;
   color_t* VRAM = (color_t*)0xA8000000;
   VRAM += LCD_WIDTH_PX*y + x;
   for(int j=y; j<y+height; j++) {
      for(int i=x; i<x+width;  i++) {
         if (*(data) != maskcolor) {
            *(VRAM++) = *(data++);
         } else { VRAM++; data++; }
      }
      VRAM += LCD_WIDTH_PX-width;
   }
}

int PRGM_GetKey(){     
  unsigned char buffer[12];     
  PRGM_GetKey_OS( buffer );     
  return ( buffer[1] & 0x0F ) * 10 + ( ( buffer[2] & 0xF0 ) >> 4 );     
}   



struct Coord {   


   int x;   


   int y;   


};   

int keydown(int basic_keycode)   
{   
   const unsigned short* keyboard_register = (unsigned short*)0xA44B0000;   
   int row, col, word, bit;   
   row = basic_keycode%10;   
   col = basic_keycode/10-1;   
   word = row>>1;   
   bit = col + 8*(row&1);   
   return (0 != (keyboard_register[word] & 1<<bit));   
}   

void moveCursor(struct Coord* cursor) {   
   if( keydown(KEY_PRGM_UP) && cursor->y>0) cursor->y-=16;   
   if( keydown(KEY_PRGM_DOWN) && cursor->y<LCD_HEIGHT_PX) cursor->y+=16;   
   if( keydown(KEY_PRGM_LEFT) && cursor->x>0) cursor->x-=16;   
   if( keydown(KEY_PRGM_RIGHT) && cursor->x<LCD_WIDTH_PX) cursor->x+=16;   
}   

int main() {     
  struct Coord cur;   
  cur.x = 0;   
  cur.y = 0;
  int a = 100;
  int b = 100;
  while(1) {     
    int key = PRGM_GetKey();     
    if(key == KEY_PRGM_MENU) {  GetKey(&key); }     
    moveCursor(&cur);   
    CopySprite(PortalBack, 0, 0, 384, 216);
    CopySpriteMasked(BigCursor, cur.x, cur.y, 12, 21, COLOR_RED);     
    CopySpriteMasked(PortalPlayer, a, b, 24, 24, COLOR_RED);
    if( keydown(KEY_PRGM_SHIFT)) {
    int c = cur.x;
    int d = cur.y;
    CopySpriteMasked(BluePortal, c, d, 24, 32, COLOR_RED); }
    if( keydown(KEY_PRGM_ALPHA)) {
    int e = cur.x;
    int f = cur.y;
    CopySpriteMasked(OrangePortal, e, f, 24, 32, COLOR_RED); }
    if( keydown(KEY_PRGM_8))
    b-=16;
    if( keydown(KEY_PRGM_5))
    b+=16;
    if( keydown(KEY_PRGM_4))
    a-=16;
    if( keydown(KEY_PRGM_6))
    a+=16;
   
   
   
   
    Bdisp_PutDisp_DD();     
    Bdisp_AllCr_VRAM();
  }     
  return 0;     
}



Whenever I press shift/alpha, the portal moves along with the cursor and disappears when shift/alpha is let go. It's supposed to just drop it and leave it. Also, I need to figure out how to make the old portal disappear when a new one of the same color is dropped. Help?

Code:
int key = PRGM_GetKey();
if(key == KEY_PRGM_MENU) {  GetKey(&key); }
better :
Code:
if(keydown(KEY_PRGM_MENU)) GetKey(&key);



Code:
if( keydown(KEY_PRGM_SHIFT)) {
int c = cur.x;
int d = cur.y;
CopySpriteMasked(BluePortal, c, d, 24, 32, COLOR_RED); }
better :
Code:
if(keydown(KEY_PRGM_SHIFT)) CopySpriteMasked(BluePortal, cur.x, cur.y, 24, 32, COLOR_RED);


About your question, if you draw the portal only when shift/alpha is pressed, it can be visible when keys are released.
I already fixed it. Check the code:


Code:
#include "keyboard.hpp"   
#include "color.h"   
#include "display.h"   
#include "keyboard_syscalls.h"   
#include "PortalPics.h"

void CopySprite(const void* datar, int x, int y, int width, int height) {     
   color_t*data = (color_t*) datar;     
   color_t* VRAM = (color_t*)0xA8000000;     
   VRAM += LCD_WIDTH_PX*y + x;     
   for(int j=y; j<y+height; j++) {     
      for(int i=x; i<x+width; i++) {     
         *(VRAM++) = *(data++);     
     }     
     VRAM += LCD_WIDTH_PX-width;     
   }     
}   

void CopySpriteMasked(const void*datar, int x, int y, int width, int height, int maskcolor) { 
   color_t*data = (color_t*) datar; 
   color_t* VRAM = (color_t*)0xA8000000; 
   VRAM += LCD_WIDTH_PX*y + x; 
   for(int j=y; j<y+height; j++) { 
      for(int i=x; i<x+width;  i++) { 
         if (*(data) != maskcolor) { 
            *(VRAM++) = *(data++); 
         } else { VRAM++; data++; } 
      } 
      VRAM += LCD_WIDTH_PX-width; 
   } 
}

int PRGM_GetKey(){     
  unsigned char buffer[12];     
  PRGM_GetKey_OS( buffer );     
  return ( buffer[1] & 0x0F ) * 10 + ( ( buffer[2] & 0xF0 ) >> 4 );     
}   



struct Coord {   


   int x;   


   int y;   


};   

int keydown(int basic_keycode)     
{     
   const unsigned short* keyboard_register = (unsigned short*)0xA44B0000;     
   int row, col, word, bit;     
   row = basic_keycode%10;     
   col = basic_keycode/10-1;     
   word = row>>1;     
   bit = col + 8*(row&1);     
   return (0 != (keyboard_register[word] & 1<<bit));     
}   

void moveCursor(struct Coord* cursor) {     
   if( keydown(KEY_PRGM_UP) && cursor->y>0) cursor->y-=16;     
   if( keydown(KEY_PRGM_DOWN) && cursor->y<LCD_HEIGHT_PX) cursor->y+=16;     
   if( keydown(KEY_PRGM_LEFT) && cursor->x>0) cursor->x-=16;     
   if( keydown(KEY_PRGM_RIGHT) && cursor->x<LCD_WIDTH_PX) cursor->x+=16;     
}   

int main() {     
  struct Coord cur;     
  cur.x = 0;     
  cur.y = 0;
  int a = 100;
  int b = 100;
  int c = 0;
  int d = -33;
  int e = 0;
  int f = -33;
  int h = 2;
  while(1) {     
    int key = PRGM_GetKey();     
    if(key == KEY_PRGM_MENU) {  GetKey(&key); }     
    moveCursor(&cur);     
    CopySprite(PortalBack, 0, 0, 384, 216);
    CopySpriteMasked(BigCursor, cur.x, cur.y, 12, 21, COLOR_RED);
    if(h == 1)
    CopySpriteMasked(PortalPlayerBack, a, b, 18, 34, COLOR_RED);
    if(h == 2)
    CopySpriteMasked(PortalPlayerFront, a, b, 18, 34, COLOR_RED);
    if(h == 3)
    CopySpriteMasked(PortalPlayerLeft, a, b, 18, 34, COLOR_RED);
    if(h == 4)
    CopySpriteMasked(PortalPlayerRight, a, b, 18, 34, COLOR_RED);
    if( keydown(KEY_PRGM_SHIFT)) {
    c = cur.x;
    d = cur.y; }
    if( keydown(KEY_PRGM_ALPHA)) {
    e = cur.x;
    f = cur.y; }
    if( keydown(KEY_PRGM_8) && b >= 0) {
    b-=16;
    h = 1;
    CopySpriteMasked(PortalPlayerBack, a, b, 18, 34, COLOR_RED); }
    if( keydown(KEY_PRGM_2) && b <= 189) {
    b+=16;
    h = 2;
    CopySpriteMasked(PortalPlayerFront, a, b, 18, 34, COLOR_RED); }
    if( keydown(KEY_PRGM_4) && a >= 4) {
    a-=16;
    h = 3;
    CopySpriteMasked(PortalPlayerLeft, a, b, 18, 34, COLOR_RED); }
    if( keydown(KEY_PRGM_6) && a <= 364) {
    a+=16;
    h = 4;
    CopySpriteMasked(PortalPlayerRight, a, b, 18, 34, COLOR_RED); }
    CopySpriteMasked(BluePortal, c, d, 24, 32, COLOR_RED);
    CopySpriteMasked(OrangePortal, e, f, 24, 32, COLOR_RED);
    if((a+9 >= c && a+9 <= c+24) && (b+17 >= d && b+17 <= d+32)) {
    a = e-18;
    b = f;}
    if((a+9 >= e && a+9 <= e+24) && (b+17 >= f && b+17 <= f+32)) {
    a = c-18;
    b = d;}
    Bdisp_PutDisp_DD();     
    Bdisp_AllCr_VRAM();
  }     
  return 0;     
}


Thanks anyways!

Edit: So, I've Decided to make another Prizm game. Iknow I have other games to work on, but Bullet is almost done. I'm not sure what to call it, but it is going to be an RPG. Here is the main character:


Give opinions please.
Girl or Guy? Also try to make the hands not turn inward, just have them at the end of the arm. And the arms are sort of bumpy, try realistically adding muscle tone [assuming male character]. Not being rude, just helpful :p
Edit: sorry I zoomed in too close, it looks good from a normal view.
Well, it's a guy(seeing that he has an opened shirt). Thanks for the opinion.
Yeah that's what I figured. So maybe fix the arms a bit and you'll be good.
What do you mean. Make them less blocky? Like this?

Spenceboy98 wrote:
What do you mean. Make them less blocky?

Well if you can a bit. Also they seem to me too spread out, not much but a little. Maybe the bump on his wrist is throwing me off. Like I said it is fine how it is, I was just being over analytical.
Animated:
There's no shading at all, the colors are awfully bright, the outlines are all black and are very blocky, the torso is very thin for someone with such large arms, and the animation looks like he's marching in place, among other critiques. I would look at this tutorial for a nice introduction into drawing humanoid sprites: http://pixel.veflaxia.net/index.html
Ashbad wrote:
There's no shading at all, the colors are awfully bright, the outlines are all black and are very blocky, the torso is very thin for someone with such large arms, and the animation looks like he's marching in place, among other critiques. I would look at this tutorial for a nice introduction into drawing humanoid sprites: http://pixel.veflaxia.net/index.html
That's awfully critical. I'll take the counterpoint and complement you on a recognizably-human figure with actual muscles and correct proportions that's not a stick figure.
KermMartian wrote:
That's awfully critical. I'll take the counterpoint and complement you on a recognizably-human figure with actual muscles and correct proportions that's not a stick figure.


Pixel art is the one thing I'm super critical about, since I can give decent critiques with it Wink You should see how I react to something I've drawn 2 days before I've critiqued it; I generally go back and yell at myself for everything I did wrong, fix it, and I make sure to make note of it for the future.

Either way, I think it needs improvements, Spence, and if you want I can try and teach you some basics about making humanoid sprites. If nothing else, a nice lesson on shading and coloring will help make him look more 3-Dimensional.
Better?

How do you use physics in C?
Spenceboy98 wrote:
Better?


Still needs some way to go... but a million times better Smile One thing it probably needs added onto it is an outline around it. Don't make it black; You should make it similar to the colors it'll surround. For example, just using what you have so far as a base, I would personally shade it like this:



Some things I was able fix through the power of outlining as well were some parts of his body that were too thin, such as his middle torso, and his feet. If you examine the outline closely, you'll notice that it's not black, but rather Yellows and Reds and Greens; they're literally the darker versions of the body parts they contain.

Next order of business, Proportions! His arms are probably the biggest area of concern, so I'll start by shortening them and making them a bit more outwards-placed. In addition, I'll lower his eyes and mouth down a pixel, they're a bit high up. I'll touch the legs up later; for now I'll shorted them by 2 pixels.



Now, I went back and gave him some eyes and removed the mouth; generally, if a sprite is going to have their mouth open, you draw it, otherwise you just don't. At least at smaller sprite sizes like what we're working with. Also, I made the torso size even smaller; it's pretty proportial now, and it doesn't give him the "really tall, super skinny" look, now he looks a bit more buffed up. I reduced the hair a bit, so that the head in general would look smaller, and fit in better.



Now to fix the legs. Since in this frame, one of his arms are in and the other is out, we have to do the reverse with each leg. Basically, have one go forward, and the other go back. The front shoe should point towards us, the other should as well, but it can angle outwards some.

Then finally, reshade the new parts, selectively outline parts, and viola.



The final result looks a lot more 3-Dimensional, and has a bit more character. When making your first sprite in a series of them to be made, spend multiple hours on it; make it look great in your eyes when you leave the computer for a break, and when you come back judge it harshly and fix everything that's wrong. Rinse and repeat, and each time it'll get better; even the final one I posted has a lot of potential to go a lot further if you lower the viewing perspective, tone down the colors to be less blaring, add some small muscle group tonings, maybe adding a few little spiffs to the hair (like, start from scratch with it, and redraw it in lines that would simulate the way the hair would flow; doing this with thread-like object always makes them look a lot better)

No one gets pixel art perfect their first try; in fact, if you can, you're probably the best pixel artist I've met. With many forms of art you get one chance at making something before you have to start over again from scratch. Pixel art has the advantage of allowing you to always go back to earlier aspects, changing things back and forth again in a click or two; take advantage of that Very Happy The revision process is painful, but the final revision and looking back on the changes over time is really entertaining.
It looks nice now. More 3D than before. Good job.
Spenceboy98 wrote:
It looks nice now. More 3D than before. Good job.



No problem, but the main purpose was for an "intro" into humanoid pixel art rather than helping you with that specific sprite Wink
  
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 1, 2, 3 ... 11, 12, 13  Next
» View previous topic :: View next topic  
Page 1 of 13
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement