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.
IndexDiscussionExhibition › Problem with pong-related game
Page Index Toggle Pages: 1
Problem with pong-related game (Read 1433 times)
Problem with pong-related game
Dec 18th, 2009, 10:05am
 
Hi everyone!
I have a problem concerning a game me and a couple of other friends are creating.

The game is like pong, but its only one pad, one ball and blocks the ball is supposed to destroy on impact.

We are only able to make the blocks dissapear temporarily while the ball is INSIDE the block, when it leaves the block comes back again.

The code we are using for this looks like this:

void blocks()  {
 blocks = loadImage("blocks.jpeg");
 for(int a=0;a<arrLenY;a++) {
   for(int b=0;b<arrLenX;b++) {
     if(ballX+dia >= xposBlock[b] && ballX-dia <= xposBlock[b]+blockWid && ballY+dia >= yposBlock[a] && ballY-dia <= yposBlock[a]+blockHei) {
         //Rectangel should be GONE!
       } else {
         image(blocks,xposBlock[b],yposBlock[a],blockWid,blockHei);
         //rectangel is there!
       }  
     }
   }
 }

Some Variables:
xposBlock[b] = array with xblock-positions, same with yposBlock[a]
blocks = image filename
dia = diameter of the ball
ellipseMode = CENTER.

If you are interested in helping us but need more information regarding the program/the full code, please tell, Im pretty unexperienced asking question about programming-related stuff like this so please have patience:) We REALLY need help with this one! Cheesy

Allright, thx alot

// Haldur

Re: Problem with pong-related game
Reply #1 - Dec 18th, 2009, 11:31am
 
Quote:
Im pretty unexperienced asking question about programming-related stuff

It shows...
Please, take time to read the descriptions of each section, and the stickies in each section. Don't post in the first section you see.
Thanks.

BTW, I am not sure to understand the problem.
But you sure shouldn't load the "blocks" image in blocks(), this should go into setup().
Re: Problem with pong-related game
Reply #2 - Dec 19th, 2009, 6:44am
 
Actually, I didnt post it in "the first section I saw" really.

The description of this section is: "What are you making with Processing? This is a place to share your finished work and work-in-progress for open discussion. "
I Just thought my question would fit in here (since its something Im making with processing plus its a work-in-progress).

I have read through all the other sections descriptions one more time and cant find anywhere else my message could fit better. Anyone know a website where I can get help these kind of questions?

Peace // Haldur
Re: Problem with pong-related game
Reply #3 - Dec 19th, 2009, 8:54am
 
OK, sorry then, but most of the topic is "Exhibition", ie. to show your work, and possibly to improve it with remarks from others. I jumped because lot of people make such mistake, possibly the description is a bit ambiguous. And so far you exhibited nothing... Smiley

There is a whole master section named "Programming Questions & Help", which is more to get help.
Syntax questions is about Processing itself, its functions, Java, etc. but it became a hodge·podge of generic questions... Sad
Programming questions seems more appropriate to your question, as you have a specific program.
Other sections are more specialized, for 3D questions, sounds, videos, electronics, etc.
If you have an issue with a library, it must be asked in Other libraries.
Re: Problem with pong-related game
Reply #4 - Dec 19th, 2009, 1:38pm
 
allright man, guess Ill try "programming questions" out then. thx alot !

// Haldur
Page Index Toggle Pages: 1