# Thread: Object and Collision [Medium Code Problem]

1. Member
Join Date
Oct 2011
Posts
3
Rep Power
0

## Object and Collision [Medium Code Problem]

Hello, its me Äppelpaj again =)

Me and My group has encountered a bigger problem then the last one =)

What do we want?
"We want the objects to place randomly with a min and max ammount of objects. (Like spikes, holes etc).
We also want a collision with an object and that object gonna kill the player"

What do we got?
"We got a class for Hole, a class for Spike, a class for Player and a class Retry."

Our Object Class:

package ForeverR;

import java.awt.Image;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Random;
import javax.swing.ImageIcon;

public class Objects{
ImageIcon k;
boolean live = true;
int x,y;
ArrayList<Objects> obstacles;
Random rand;

public Objects(){
k = new ImageIcon("C:/Retry.png");
obstacles = new ArrayList<Objects>();
}

void initateObjects(){
for (int i = 0; i < obstacles.size(); i++) {

}

}

boolean getLive(){
return live;
}

public Image getImage(){
}

public void collision(){

/** if collision
* you die
* we call for reset
*/
}

public void reset(){

/**
* we put the nice lite reset screen here
* you choooose to continue or to go back to menu
*/

}

public Rectangle getBounds() {

return new Rectangle (x, y, 60, 60);
}
}

What is wrong with this script and why cant we get it right?(

2. Member
Join Date
Oct 2011
Posts
3
Rep Power
0

## Re: Object and Collision [Medium Code Problem]

Greettings //ÄppelPaj

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•