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

  • Home
  • SEARCH
  • 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
  • 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. 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
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have some data like this: 1 2 3 4 5 9 2 6
I want use html5's new tag to play a wav file (currently only supported
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

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.