Results 1 to 2 of 2
  1. #1
    Äppelpaj is offline Member
    Join Date
    Oct 2011
    Rep Power

    Smile 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{
    Image resetMenu;
    ImageIcon k;
    boolean live = true;
    int x,y;
    ArrayList<Objects> obstacles;
    Random rand;

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

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



    boolean getLive(){
    return live;

    public Image getImage(){
    return resetMenu;

    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. #2
    Äppelpaj is offline Member
    Join Date
    Oct 2011
    Rep Power

    Default Re: Object and Collision [Medium Code Problem]

    Please help me and my friends =)

    Greettings //ÄppelPaj

Similar Threads

  1. Event Collision (What I call it) Problem.
    By Alerhau in forum New To Java
    Replies: 4
    Last Post: 08-06-2011, 09:10 PM
  2. Error Object Expected, Code 0
    By martinmilroy in forum Java Applets
    Replies: 0
    Last Post: 04-14-2011, 09:07 AM
  3. Replies: 0
    Last Post: 02-21-2011, 12:50 PM
  4. Replies: 6
    Last Post: 10-11-2010, 01:59 PM
  5. Problem in collision between objects
    By Chetans in forum Java Gaming
    Replies: 3
    Last Post: 03-16-2010, 12:24 AM

Posting Permissions

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