Do in SFML (c++) Use A* -algorithm for this assignment. Work on a 32 × 32 grid o
ID: 3814607 • Letter: D
Question
Do in SFML (c++)
Use A* -algorithm for this assignment.
Work on a 32 × 32 grid of tiles. There are two types of tiles: traversable and non-traversable.
Here is a suggestion for data structures:
You can store the tiles in a timemap class
Note that a tile doesn’t know its own position. It is the position of the tile in the array which determines where it is put on the screen.
a) Use the data structures above for your tilemap and implement functions for drawing the tilemap to the screen. Implement functionality so that you can hover over a tile with the mouse pointer and change its type by clicking. Choose a colour scheme so that open, closed and untraversable can be seen on the drawing of the tilemap.
Someone help me? At least how to begin?
Explanation / Answer
You can convert (x', y) from your coordinate system to (x, y) in this one using:
So dx becomes:
Careful with rounding when implementing this using integer division. In C for int y floor(y/2) is (y%2 ? y-1 : y)/2.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.