Search:

Type: Posts; User: Montario

Page 1 of 2 1 2

Search: Search took 0.25 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: Eclipse Error: Could not open the editor: The file does not exist?

    Oh ok, thank you! I managed to fix it, for some reason I needed to create the project again with the same name? I don't know why but it worked, all my classes are restored. Eclipse must have lost the...
  12. Re: Eclipse Error: Could not open the editor: The file does not exist?

    Thanks for the reply,



    I can't even find the parent folder/package in eclipse, I've tried the package explorer and navigators, there is no directory for me to find it. The files are not...
  13. 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.
  14. Eclipse Error: Could not open the editor: The file does not exist?

    Hello everyone, I have been using Eclipse as a Java IDE for a while now and came to my first big problem. I have been creating a game for a few months now with no problems, now when I run eclipse and...
  15. 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?
  16. 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...
  17. 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...
  18. Replies
    35
    Views
    935

    [SOLVED] Re: Image looping issue

    Thank you Norm, the problem was I kept on mixing up my x and y values which returned a result I did not want. I also declared the variables holding the x and y value changes after the loop was...
  19. Replies
    35
    Views
    935

    [SOLVED] Re: Image looping issue

    Pretty much all the code I posted you is working at the moment as it is only considering the left and bottom lines. I do not know how to do the top or right lines as each time I try it never works...
  20. Replies
    35
    Views
    935

    [SOLVED] Re: Image looping issue

    currentX= 115, currentY = 157 are the values printed out. Let me show you the whole current code so you can see what I am actually talking about.



    private void drawMaze(Graphics2D g){
    ...
  21. Replies
    35
    Views
    935

    [SOLVED] Re: Image looping issue

    For testing purposes, I wanted the first column to start at y = 10, x = 10 and print 7 times to end up at y = 115, x = 10. The same principal would work for the next column and row. The problem came...
  22. Replies
    35
    Views
    935

    [SOLVED] Re: Image looping issue

    That is in fact what the print looks like when the images printed are not where I want them to be. To see my actual visual problem with the images, look here: 1269

    The images are at the moment...
  23. Replies
    35
    Views
    935

    [SOLVED] Re: Image looping issue

    I get an infinite pattern of this:

    currentX= 31, currentY = 115, xOffset = 21yOffset = 21 and length = 7
    currentX= 52, currentY = 115, xOffset = 21yOffset = 21 and length = 7
    currentX= 73,...
  24. Replies
    35
    Views
    935

    [SOLVED] Re: Image looping issue

    I am a bit confused as to what is going on here, what are all the '=' and quotes at different places for?
  25. Replies
    35
    Views
    935

    [SOLVED] Re: Image looping issue

    I don't understand what you mean by println statements? Aren't those only for strings? Sorry, i'm still getting used to java!
Results 1 to 25 of 47
Page 1 of 2 1 2