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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:22:00+00:00 2026-05-31T05:22:00+00:00

I made a collision detection in the Update() section, and this is the code:

  • 0

I made a collision detection in the Update() section, and this is the code:

            if (player.playerRect.Intersects(turtleRect))
        {
            turtleRect.X = turtleRect.X - 60;
        }

When I run the game, and collide with the turtle, nothing happens. I tried changing the

turtleRect.X = turtleRect.X - 60;

To

turtleRect.X = turtleRect.X - 600;

Because I thought I wasn’t noticing the change. Still, nothing happened. Then I thought it was just the

turtleRect.X = turtleRect.X - 600

So I put that in the Update() method, outside of the if statement and it worked. Now I realize that it is the

                if (player.playerRect.Intersects(turtleRect))
        {

        }

But I cannot figure out what is wrong with that. I have the playerRect in a different class, but I imported it into the main class. I know the Rectangles are moving because of the

            turtleRect.X -= 1;

in the Update() method.
The turtle moves across the screen. I have tested many things, and looked it up and I still can’t figure it out. This is the rectangle collision, so could somebody also guide me on how to do the per pixel collision? Any help is appreciated.

  • 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-31T05:22:01+00:00Added an answer on May 31, 2026 at 5:22 am

    I solved this, I just added:

    playerRect = new Rectangle((int)player.position.X, (int)player.position.Y, player.playerRect.Width, player.playerRect.Height);
    

    Thanks for all the help!

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

Sidebar

Related Questions

Made this nice little loop for hiding and showing div's, works as a charm
I made a code that translate strings to match each word from the array
My current setup is only useful once collision has been made; obviously there has
I have a little archer game I'm working on, and previously in my code
I made this application that lets the user draw a line on the screen
Can anyone explain what is the math/physics behind this popular PSP game Locoroco. My
NOTE: As per ECMAScript5.1, section 15.1.1.3 , window.undefined is read-only. Modern browsers implement this
I am developing a 3d shooter game that I would like to run on
Inheriting code from other developers has made me a firm believer in keeping as
I'm developing simple traffic educational game like https://market.android.com/details?id=cz.allianz.krizovatky.android . When the player taps on

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.