Search:

Type: Posts; User: Montario

Search: Search took 0.07 seconds.

  1. Re: Collision Detection between Sprites and Images?

    Thanks, I've done that, though the person is still going through the cobblestone images. What part of the code shall I post to you?
  2. Re: Collision Detection between Sprites and Images?

    I know how to express 'dx = 0;', the problem is dx is not recognized as a variable in board.java. Do I do this? This is in board.class if that helps.


    if (r1.intersects(r2)) {
    }
    ...
  3. Re: Collision Detection between Sprites and Images?

    Oh apologies, I posted the wrong code, the errors were already resolved, the interface never refreshed to reflect that yet. Here is my code using the methods:



    public int getdx() {
    return...
  4. Re: Collision Detection between Sprites and Images?

    public Person(int dx, int dy) {

    ImageIcon i = new ImageIcon(this.getClass().getResource(person));
    image = i.getImage();
    width = image.getWidth(null);
    height = image.getHeight(null);...
  5. Re: Collision Detection between Sprites and Images?

    I tried, but then I come up with many errors stating that the variable could not be resolved. Where in person.java shall I create the method?
  6. Re: Collision Detection between Sprites and Images?

    I need to access them as I want to set dx and dy to zero if both the person and cobblestone intersect each other. How do I make that reference? I have tried person.dx though that does not work.
  7. Re: Collision Detection between Sprites and Images?

    package outrun;

    import java.awt.Image;
    import java.awt.event.KeyEvent;
    import java.awt.Rectangle;

    import javax.swing.ImageIcon;

    public class Person {
  8. Re: Collision Detection between Sprites and Images?

    What I meant by was if they both collide with each other, sorry, I wasn't to clear! I do not want to change the variables. I want to use the variable dx and dy from board.java in person.java though I...
  9. Re: Collision Detection between Sprites and Images?

    I know what I want to happen, I just don't know how to show it. If they both collide, I want the variables dx and dy to be equal to zero. The trouble is those two variables are in the person class,...
  10. Re: Collision Detection between Sprites and Images?

    Ok, so I have made rectangle classes for both cobblestone.java and person.java (the images I wish to intersect.) Now I am actually determining the collision in my board.java:


    public void...
  11. Re: Collision Detection between Sprites and Images?

    Ok I will work on that, Eclipse somehow does not want to open my files stating that the files do not exist. I will resume work once I get that sorted from someone.
  12. Re: Collision Detection between Sprites and Images?

    The person has width and height, it is an image I created. Would I need to use getWidth() and getHeight() and assign them to two new variables?
  13. Re: Collision Detection between Sprites and Images?

    Oh yes, but how would I go about creating a rectangle for the person, it moves? The parameters consist of x and y values. How would I be able to create one if the person is moving, hence constantly...
  14. Collision Detection between Sprites and Images?

    Hello everyone :)

    I am creating a small game and have come to the point where I need to use collision detection. The problem is, I do not exactly know how to create basic collision with...
Results 1 to 14 of 14