We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Newb who wants to make game
Pages: 1 2 3 
Newb who wants to make game (Read 7771 times)
Re: Newb who wants to make game
Reply #30 - Jan 30th, 2007, 2:18am
 
Hmmm, I was trying to figure out that flipping thing, but I couldn't get it to work for just a small picture. Could you either explain it to me or give me an example of how it would pork for an individual picture which isn't the full screen?
Re: Newb who wants to make game
Reply #31 - Jan 30th, 2007, 2:57am
 
you could do something like:
Code:

PImage pic;
PImage pic_flipped; // keep a cached version in here

boolean drawFlipped = false;

void setup()
{
pic = loadImage( "Picture.png" );
}

void draw ()
{
background(123);

if ( drawFlipped )
image( flipPic(pic), 10, 10 );
else
image( pic, 10, 10 );
}

void mousePressed ()
{
drawFlipped = !drawFlipped;
}

PImage flipPic ( PImage _img )
{
if ( pic_flipped != null )
return pic_flipped; // cached version
else
pic_flipped = new PImage( _img.width, _img.height, _img.format );

// copy pixels over ..
int indx = _img.width * _img.height;
int indxF = 0;
for ( int y = _img.height; y > 0 ; y-- )
{
indx -= _img.width;
System.arraycopy( _img.pixels, indx,
pic_flipped.pixels, indxF,
_img.width );
indxF += _img.width;
}

return pic_flipped;
}


F
Re: Newb who wants to make game
Reply #32 - Jan 2nd, 2010, 6:08am
 
hello,

how far did you come with the game?
Any results?

Thanks!

Interesting thread!

Chrisir
Re: Newb who wants to make game
Reply #33 - Jan 2nd, 2010, 8:50am
 
Chrisir

dfarce who started this thread has not visited this forum since March 26th 2009 and has not posted something for nearly 3 years so it is unlikely you will get a reply.

You said
Quote:
Interesting thread!

If your interest is in using animated sprites you might want to look at this library.
http://www.lagers.org.uk/s4p/index.html

Smiley
Re: Newb who wants to make game
Reply #34 - Jan 2nd, 2010, 8:57am
 
Thank you very much!
Pages: 1 2 3