It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Could someone please give me some direction on how to spawn enemies in a circle (XNA Programming)?
I want the enemies to randomly spawn along the circumference of a circle that is just outside the bounds of the window. I want them to move in straight lines through the center of the window and out to the opposite side of where they started (or as close to that as possible).
Ideally this would create an environment where enemies are randomly coming across from seemingly all directions. Any help would be appreciated.
Just generate a random number between 0 and 360 (or 0 and 2π if it uses radians), and use trigonometry based on the radius of the circle you want.
Related
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
How can we remove sprites from certain co-ordinates position on the screen on occurance of certain event in C#-XNA?
Typically you don't erase anything from the screen. Instead, for every frame, you render everything into a buffer and then render the finished buffer to the screen (to avoid flickering). When the next frame comes, it simply overwrites the previous content on the screen.
So, as said in the comment, you don't erase a sprite - you just don't render it in the next frame. How you achieve that depends on how you manage your Draw cycle.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I read this article: http://www.policyalmanac.org/games/aStarTutorial.htm, but i don't understand how is calculated G cost. I know those child's on corner of his parent have bigger score but there is probably another calculation to check distance from current to start node.
Please help.
In the article,
It was stated that G=10 if you move horizontal or vertical and
G=14 if you go diagonal from one square to another square.
Hence if you move horizontal from start square G = 0+10
where initially G is 0. Then you move vertical or horizontal from there implies G=10+10
and if diagonal means G=10+14
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I previously posted on this and showed my code for getting an explosion of bullets
going in a number of directions all at one time.
I was just wondering if someone could give me a clean example that I can go off of.
My idea was to have my left click make the player throw a grenade and when it collides with an enemy it explodes and bullets come out of every direction.
sorry for the double post,
thanks.
if(whatever the collision code is for xna again)
{
bullets.add(new bullet(startpos, direction))
}
if you expand that... bullets is whatever your using to manage your bullets, bullet is your newly created particle with a start position being where your collision took place, the direction will be a direction that your bullet should travel in (1 for north,ne,east,se,south,sw, west, nw) or whatever yo uwant
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I made the camera position 10 units from an object, but not behind it. I dont want the camera position behind the object right away when it rotates, I want that when I will rotate the object, the camera position will move slowly until it will be behind the object.
Check out the Camera Sample in XNA App Hub: http://create.msdn.com/en-US/education/catalog/sample/chasecamera
It basically does what you describe: it's a chase camera that lags behind the object and follows it using a "spring like" behavior.
From the overview: "The motion of both the ship and the camera are governed by simple physics. When the ship speeds away, the camera pulls back. When the ship turns, the camera lags behind in the turn to show a partial profile view of the ship. When the ship stops moving, the camera gradually slides back into place"
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I was reviewing a code from a simple PONG game code in c#, the logic as far as I could understand was reading a key press (UP and Down) in a infinte loop and update the position of the ball and bar each n milliseconds one after another.
I want to know how to draw objects on a graphic box simultaneously?
I am just interested in making simple games using a imagebox and simple graohics.
If you want to make really simple games like Tetris or other puzzle-like, you could simply drop the "infinite loop" part. I've seen plenty of simple games built with Winforms/user controls/standard events (keypress/mousemove...).
If you plan to write something more complicated, then you probably want start learning XNA. Microsoft kindly provides useful starter kits.
You don't do it simultaneously, you do it in a loop but that loop happens so fast that a human cannot tell they are being updated one at a time.