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

  • SEARCH
  • Home
  • 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 6127491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:30:56+00:00 2026-05-23T16:30:56+00:00

Description: I’ve got a project which is nearly finished now, but I’ve noticed the

  • 0

Description:

I’ve got a project which is nearly finished now, but I’ve noticed the collision is not really working. It’s a snake-like game that can be controlled via the touch-screen, so sharp (?, sorry german) angles are possible. At the moment I just leave a bit of tolerance (ignore the first 2 sprites) to enable a bit of turning. The main problem is that the sprites are being rotated which results in overdimensional collision boxes. I’m not using any game engines or OpenGL.

Collision Code:
offsetX & offsetY are the bitmaps width or height / 2, is called on the head of the snake. Each link in the snake (Bird) is a placeable

public boolean doesHit(Placeable p) {
    int xLen = Math.abs(this.x - p.x);
    int yLen = Math.abs(this.y - p.y);
    if (bmp != null) {
        if (xLen < offsetX + p.offsetX && yLen < offsetY + p.offsetY)
            return true;
    } else {
        if (xLen < Bird.BIG_W[Bird.mUseBird] / 2
                && yLen < Bird.BIG_H[Bird.mUseBird] / 2)
            return true;
    }
    return false;
}

TL;DR / Question:

Is there a way to rotate Rects and then compare them (preferred, as the game is already finished apart from this)? Or would the simplest way be to port to OpenGL / a game engine?

  • 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-23T16:30:57+00:00Added an answer on May 23, 2026 at 4:30 pm

    The best option would be to go OpenGL and use rotated polygons with intersects.

    However for quick hack i would change the doesHit() routine to consider the sprites as circles instead of rectangles. This way they will not grow outside bounds when rotated. The price is that collision detecting will be lousy in the corners.

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

Sidebar

Related Questions

Project Description: I have to make an application in android which gets the Latitude
I found a good description on wikipedia with a few reference links, but there
Description for Assert.Equals() from the MSDN Documentation: Do not use this method. That's it,
Description: Obtain output from an executable Note: Will not compile, due to fgets() declaration
problem description I've got a Delphi component. To set a value, you can click
My description paragraph contains ( and ') but when I try to save data,
APPLICATION DESCRIPTION : I am a new iPhone developer. I am working on an
Short Description The question is not meant to ask if using virtual environments are
Problem description: I wanted a delete function which could perform delete/remove of the selected
![enter image description here][1] I want to make a tab layout application, in which

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.