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 7248999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:13:20+00:00 2026-05-28T22:13:20+00:00

For starters, how can I use defineCollisionRectangle API ? I’ve done some research about

  • 0

For starters, how can I use defineCollisionRectangle API?

I’ve done some research about it and I think it doesn’t have any use at all.

True that I can just use collidesWith() to check if 2 sprites collide.

But what I want to use a sprite that has parameters like house with a backyard fence around it.

I tried using the defineCollisionRectangle() in a condition, set it in the constructor but I don’t know how to use it.

I can just use object.getX/gety and object.getWidth/getHeight, to make a Parameter around the sprite.

What does defineCollisionRectangle really do and how do I use it?

  • 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-28T22:13:21+00:00Added an answer on May 28, 2026 at 10:13 pm

    To detect collision for objects like house with a fence around it I would start with defining two Sprite objects – one for fence, another for house – each with its own collision rectangle.

    To render a house with fence around it, I’d draw houseSprite over fenceSprite like at the sketch below:

    https://i.stack.imgur.com/4Wn5B.jpg

    With this approach it would be really easy to tell whether collision happened with fence or with house – simply because each defines its own collision rectangle.


    Generally, when you find out that single collision rectangle doesn’t do what you need, you invent a way to decompose things to more rectangular sub-elements so that when combined, these elements simulate / approximate desired behavior.

    • End users just don’t care how many Sprite objects are there behind the scene. They’re happy as long as end result feels about like house with a backyard fence around it.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im building a REST webservice and have of course done some research but are
Ok, a few things I'm not quite sure about. For starters: I have a
I have starter new System.Diagnostics.Process and it launchs FireFox. How can I obtain the
For starters, this question is not so much about programming in the NetBeans IDE
So, I use boost::shared_ptr for all the various reference-counting benefits it provides -- reference
Hey all. I know this sounds simple, but I can't find a way to
Why should we use XSLT to web parts? Can anyone please route me to
wondering about the best way to approach this particular problem and if any libraries
Hello I want to create a dll with some functions. For starters I'm trying
I have an asynchronous UDP server class with a socket bound on IPAddress.Any, 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.