Tag Info

New answers tagged

1

You can always just do a naive approach. Just iterate through all pieces and see if there's a match in any direction, and if you get to the end before any matches are detected, then you have no matches.


-2

This one looks interesting: http://www.codeproject.com/Articles/455 I wonder is it better than A*?


1

I'm assuming you will award bonus time very some amount of points (i.e. every 100 points, starting at 200), But this can be modified to handle any type of case. Just use integer division to check if the value has been reached and update the last awarded value when reached. For example: // this value should be global scope (class member) int last = 1; // ...


0

My suggestion is that there is a moment where you are going to add points to the score. Before that instant check if the score is less than the threshold AND the score + new points is greater than it.


0

I would do something like this: int pixelPerFPS; // pixel per FPS void move(int x, int y); void update(int time) { character.currentX += (character.goalX - character.currentX) / abs(character.goalX - character.currentX) * pixelPerFPS; character.currentY += (character.goalY - character.currentY) / abs(character.goalY - character.currentY) * ...


1

If you are talking about move horizontally and vertically at a same time, the problem is not here. You are doing fine. Maybe problem belong to input module. About A*, it's a path finding algorithm, it return series of point present the path you ask for. Movement is another problem, don't stick it with A*. The easiest way to implement moving system are ...


1

I think that tutorial actually contains all you need. It mentions that the order of rotations is Z, then X, then Y. I don't know Unity's quaternions, but you are either doing Z then Y then X, or the reverse. Try swapping x_rotation and y_rotation when you calculate your final rotation.


2

Your question is quite broad and underspecified, so in this answer I'll focus on finding river flows. Within the field of computational geometry there is quite a bit of research on the topic of drainage networks on a terrain. An overview can be found in section 3.5 of this article: Digital Elevation Models: overview and selected algorithms. A useful ...


5

Scenario It seems your pathfinding and collision detection have different ideas of what's OK, when it comes to walking around corners. Say your pathfinding plans out this path (brown squares are walls, yellows are empty space, green is an enemy character, arrows are the planned path): The enemy character then moves directly toward each point from the ...


5

How about letting box2d do the work for you? It wasn't too difficult for me to setup everything in RUBE: There are two major parts: the wheel and the needle. Wheel First there is a base. In this case the base is a static body with a square fixture. The wheel is attached to the base via a revolute joint. This joint allows the wheel to spin freely ...


5

Since Hearthstone is written in Unity it is trivial to decompile the scripts (because .NET), and this does in fact allow us to see the algorithm for deck building. The algorithm (found in RandomDeckMaker.GetChoices) is actually very simple. It basically tries to pick random cards to bring the deck to the following distribution: 12 class-specific cards ...


0

As a side-note, your use of EndIf makes me think you're trying to do this in PHP - which makes no sense whatsoever, but whatever. It would help if you could clarify what language you're working with. But concerning the mathematics alone... The two events you need to catch are when the edge of the space contacts the needle and when the edge breaks contact ...


3

Fundamentally I think this is a problem with the grid-based ray casting being a pretty inaccurate and granular approximation of the 'real' thing you're trying to simulate. No matter what you'll do you'll run into problems. Instead of thinking about it in terms of the specifics of the iteration and implementation, think of it as if your world was actually ...



Top 50 recent answers are included