Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4612368
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:23:37+00:00 2026-05-22T01:23:37+00:00

I am making a small game, with a friend. Now, I have a camera-system,

  • 0

I am making a small game, with a friend. Now, I have a camera-system, I am walking by basicly just changing x and y values of environment objects. Example:

    public void move(){
    if(player.up){
        enemyposy += player.speedY;
        hostageposy += player.speedY;
        grassy += player.speedY;
        ammoboxy += player.speedY;
        healthkity += player.speedY;
        helipady += player.speedY;
        bushy += player.speedY;
    }

This will move all those objects, down when you press the up button, so it creates an illusion that the player is moving, which it isn’t. Now, I tried and create a collision system by doing this:

    public void checkCollision(){
    if(player.getBounds().intersects(enemy.getBounds())){
        System.out.println("Colliding with Enemy");
        healthdown.start();
    }else{
        healthdown.stop();
    }

But, when I go to the enemy, and touch it, it won’t react like it’s touching, it’s not saying “Colliding with Enemy.”, however I AM in the player. Can somebody perhaps tell me why it’s not responding, and give me a solution on how to solve it?

getBounds method:

    public Rectangle getBounds(){
    return new Rectangle(getX(),getY(), 20, 20);
}

player getBounds is exactly the same.

intersects is an already implemented method.

boolean java.awt.Rectangle.intersects(Rectangle r)

Determines whether or not this Rectangle and the specified Rectangle intersect. Two rectangles intersect if their intersection is nonempty.

Parameters:
r the specified Rectangle
Returns:
true if the specified Rectangle and this Rectangle intersect; false otherwise.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T01:23:38+00:00Added an answer on May 22, 2026 at 1:23 am

    In the code you show you don’t update player.x so player.getX won’t change. The same for enemy 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a small, survival-based game. Now what I want to know is how
I am making a small iOS game, and have finished everything, except the sound.
I'm making a small game and I have a character that can move in
I'm making an online tile based game and I have just finished scripting the
I'm making a small game engine and need to have a memory pool associated
I am making a small hobby game, I have a couple of classes so
I am making a small game in flash, I would like to track scores
Hi. I've got a small game using directX10 and C++. However, I started making
I've been making small scale projects for a while now. I haven't started a
I'm making a small web application in Seaside. I have a login component, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.