Question

i m working on a prototype game, a MOBA test :D

And im having problems with the movement. I wanna have it like in League of Legends, a click-to-walk system. Also so the character faces where it walks.

It's gonna be a 2D-topdown game.

I've been thinking, i have a player, and a dot class.

In the dot class i can put a variable like: isVisible. And in the draw method :

public void Draw(SpriteBatch spriteBatch) {
    if (isVisible) {
        spriteBatch.Draw(//.....)
    }
}

And in the player, something like:

if (dot.isVisible) {
    //moving towards point code
}

Would that work?

Thanks in advance!

Was it helpful?

Solution

Yeah that should be fine. Seems like a good way to deal with it, but you could also just store a Point(or Vector3 I think) object, and set it to null when there is no point to go to.

public void Draw(SpriteBatch spriteBatch) {
    if (point != null) {
        spriteBatch.Draw(//.....)
    }
}

if (point != null) {
    //moving towards point code
}

This may also help with your //moving toword point code issue https://gamedev.stackexchange.com/questions/53879/xna-moving-towards-3d-point-rts-style though when I was looking into pathfinding last the best I could find was white papers.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top