Jump to content
  • 0

skill for checking cell and mob


Question

Posted

Hello guys
I'm trying to make a course analysis skill.
To count how many monsters were found between the player and the cell clicked.
The player clicks somewhere on the map, and checks (cell by cell) on that route.
  If I find any mobs in the cell then it displays on the console for me:

example:

Printf ("% d Mob found", count);

I know that (src-> x,src-> y) are the coordinates of the skill invoker
And (x, y) are the coordinates of the clicked cell.

Now I need to make a for() to go check cell by cell until it reaches the target cell.
But how to do that? I'm having a hard time
Can someone help me?

Or does anyone know a function to do this?

For those who understand the language C, it should be super easy to do that.

I think logic is something like this:

		case TEST:	
	
		int mob,x,y; 
		int dir = map->calc_dir(src,x,y); //Calculate direction
	
				for () { 	//Looping for traversing cells by cell

					x += dirx[dir];
					y += diry[dir];

						if(){    //If you have a Mob in the cell
							printf(" %d Mob found, mob"); //mensage in console
							mob++;
							}

				}
                  
          break;

Someone can help me, please, I do not know who to ask for help.
 

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...