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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:39:28+00:00 2026-06-16T01:39:28+00:00

Using theses variables how would i go about colliding pacman with a munchie? I

  • 0

Using theses variables how would i go about colliding pacman with a munchie?
I already have movement and the ceiling down it do sent have to be given the code more like explain what I would have to do.

Pacman variables
private Point frameSize = new Point(32, 32);    // Pacman image size
private Point currentFrame = new Point(1, 0);   // Start frame
private Point sheetSize = new Point(2, 4);      // Spritesheet size
private Vector2 pacmanPos;                      // Pacman position in pixels
private int pacmanSpeed = 8;                    // Pacman movement speed in pixels

// Game
SpriteBatch spriteBatch;
Texture2D munchie1, munchie2, pacman;

// Sounds
SoundEffect collisionSound;

// Random number generator
Random rand = new Random();

// Total number of munchies 
private int noOfMunchies = 5;

Vector2[] munchiePos;
private int munchieSize;
private int[] munchieAnimationCount;

private int timeSinceLastFrame = 0;
private int milliSecondsPerFrame = 500; // 2 Frames Per Second (fps)
  • 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-06-16T01:39:29+00:00Added an answer on June 16, 2026 at 1:39 am

    Since you’ve defined munchieSize but not pacmanSize I suppose that you’re considering your actor a dot. In that case, assuming that pacman’s and the munchies’ coordinates are relative to the same system, it will be enough to check in each frame or collision test iteration if pacman’s position’s vector is contained in any of the munchies’ bounding box.

    You can do it this way, consider that my code is just a reference and you should use your own types to achieve the result.

    var munchies = new PointF[5];
    const int munchySize = 10;
    var pacmanPos = new PointF();
    var collidesWith = munchies.
        Where(m => new RectangleF(m, new SizeF(munchySize, munchySize)).Contains(pacmanPos));
    var collisionHappened = collidesWith.Any();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables (using table variables for illustration. You can run these directly
I'm using CakePHP's ACL component to manage permissions for my app. I have about
I am using R to analyze genome-wide association study data. I have about 500,000
t = Time.now d = 10.minutes.from_now Using these two variables, how do I output
I am using these rules and conditions in .htaccess to turn these http://www.example.com/index.php/about/history http://www.example.com/about/history/index.php
We have an ASP.net 2.0 web application which is using themes set on the
What is the best practice when nesting method calls or using one-shot variables? Should
Situation: I have a DAY structure. The DAY structure has three variables or attributes:
A week ago I would have done this manually: subset dataframe by group to
I currently have 2 JavaScript variables in which I need to retrieve values from.

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.