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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:32:37+00:00 2026-05-11T08:32:37+00:00

I’m working on a roguelike style cellphone game that operates on a grid. Attacks/Items

  • 0

I’m working on a roguelike style cellphone game that operates on a grid. Attacks/Items in this game operate by targeting tiles in a pattern relative to the user. The paturn is usually relative to the direction the user is aiming in as well, For instance in this screenshot the pattern

Point2d[] damageTiles = new Point2d[4];  damageTiles[0] = new Point2d(0, -1); damageTiles[1] = new Point2d(0, -2); damageTiles[2] = new Point2d(1, -2); damageTiles[3] = new Point2d(-1, -2); 

is show relative to a temporary enemy(the yellow box) aiming ‘up’.

I currently have simple code to rotate a pattern array by 90 degree increments, as seen here. My question is, Is there an easy way to rotate an array of 2d points by 45 degree increments, allowing my Attacks/Items to fire on the diagonal, preferably without using floating point math, as it tends to run slowly on many phones(or so i hear). This is probably a trivial question to anyone familiar with graphics programming, but I’ve been hit with a case of coder’s-block.

My current rotation code is shown below. I now realize that a better way to do it would be to take an angle instead of a ‘direction’ and rotate the points by that angle (rejecting angles that are not multiples of 45 of course).

private Point2d[] rotateList(Point2d[] points, int direction) {     for (int i = 0; i < points.length; i++) {          if (direction == ROTATE_LEFT) {             int temp = points[i].x;             points[i].x = points[i].y;             points[i].y = -1 * temp;         }         else if (direction == ROTATE_RIGHT) {             int temp = points[i].x;             points[i].x = -1 * points[i].y;             points[i].y = temp;         }      }      return points; } 
  • 1 1 Answer
  • 2 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. 2026-05-11T08:32:37+00:00Added an answer on May 11, 2026 at 8:32 am

    The T-shaped attack you show would be difficult to rotate at 45 degrees–things don’t really translate from 90 to 45.

     original: ..... .###. ..#.. ..o..  alternative A: ..... .##.. .##.. ...o.  alternative B: ..#.. .#... #.#.. ...o. 

    There could easily be others for that pattern.

    I recommend you create a 45 degree ‘Pattern’ to match you 90 degree pattern, then rotate the 45degree pattern exactly the same way you rotate your 90 degree patterns.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into

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.