Search Results

Search found 18 results on 1 pages for 'topdown'.

Page 1/1 | 1 

  • 2D Topdown Shooter - Player Movement Relative to Mouse

    - by Jarmo
    I'm trying to make a topdown 2D space game for my school project. I'm almost done but I just want to add a few little things to make the game more fun to play. if (keystate.IsKeyDown(Keys.W)) { vPlayerPos += Vector2.Normalize(new Vector2(Mouse.GetState().X - vPlayerPos.X, Mouse.GetState().Y - vPlayerPos.Y)) * 3; rPlayer.X = (int)vPlayerPos.X; rPlayer.Y = (int)vPlayerPos.Y; } if (keystate.IsKeyDown(Keys.S)) { vPlayerPos += Vector2.Normalize(new Vector2(Mouse.GetState().X - vPlayerPos.X, Mouse.GetState().Y - vPlayerPos.Y)) * -3; rPlayer.X = (int)vPlayerPos.X; rPlayer.Y = (int)vPlayerPos.Y; } This is what i use to move towards and away from my mouse crossair. I tried to make a somewhat similar function to make it strafe with "A" and "D". But for some reason I just couldn't get it done. Any thoughts?

    Read the article

  • 2D Topdown Shooter Mouse Movement

    - by Jarmo
    I'm trying to make a topdown 2D space game for my school project. I'm almost done but I just want to add a few little things to make the game more fun to play. if (keystate.IsKeyDown(Keys.W)) { vPlayerPos += Vector2.Normalize(new Vector2(Mouse.GetState().X - vPlayerPos.X, Mouse.GetState().Y - vPlayerPos.Y)) * 3; rPlayer.X = (int)vPlayerPos.X; rPlayer.Y = (int)vPlayerPos.Y; } if (keystate.IsKeyDown(Keys.S)) { vPlayerPos += Vector2.Normalize(new Vector2(Mouse.GetState().X - vPlayerPos.X, Mouse.GetState().Y - vPlayerPos.Y)) * -3; rPlayer.X = (int)vPlayerPos.X; rPlayer.Y = (int)vPlayerPos.Y; } This is what i use to move towards and away from my mouse crossair. I tried to make a somewhat similar function to make it strafe with "A" and "D". But for some reason I just couldn't get it done. Any thoughts?

    Read the article

  • Appropriate USB enclosure to use with an Ultra ATA drive

    - by Topdown
    I have a friend with a broken iBook, but we wish to recover the hard disk. I haven't seen the drive itself, however the spec lists it as an "Ultra ATA drive". Could you please advise if this is 100% compatible with any standard USB IDE 2.5inch enclosure? Full spec: iBook 12" 1GHz(AP) 256MB DDR266 SDRAM built-in Keyboard/Mac OS X Bluetooth Module 40GB Ultra ATA drive Combo (DVD-ROM/CD-RW).

    Read the article

  • Recover a folder or file in TortoiseSVN whilst also retaining all history.

    - by Topdown
    In revision 1 a folder existed. In revision 2 the folder was accidently deleted and the change committed. We wish to roll back such that the folder is present, and retain its history. In the TortoiseSVN docs it indicates 'how' in the section titled "Getting a deleted file or folder back". To quote: Getting a deleted file or folder back If you have deleted a file or a folder and already committed that delete operation to the repository, then a normal TortoiseSVN - Revert can't bring it back anymore. But the file or folder is not lost at all. If you know the revision the file or folder got deleted (if you don't, use the log dialog to find out) open the repository browser and switch to that revision. Then select the file or folder you deleted, right-click and select [Context Menu] - [Copy to...] as the target for that copy operation select the path to your working copy. A switch retrieves the file into my working copy as one would expect, however there is no "Copy to" option on the context menu when I right click this working copy. If I open the repos browser, there is a copy to option, but it seems this simply takes a copy of the file. The solution I feel is to do a Branch/Tag, but if I try this from a prior revision to the same path in the repository SVN throws error that the path already exists. Therefore, how do I recover a folder/file in TortoiseSVN whilst also retaining all history. TortoiseSVN v1.6.8, Build 19260 - 32 Bit , Subversion 1.6.11,

    Read the article

  • Delegate within a delegate in VB.NET.

    - by Topdown
    I am trying to write a VB.NET alternative to a C# anonymous function. I wish to call Threading.SynchronizationContext.Current.Send which expects a delegate of type Threading.SendOrPostCallback to be passed to it. The background is here, but because I wish to both pass in a string to MessageBox.Show and also capture the DialogResult I need to define another delegate within. I am struggling with the VB.NET syntax, both from the traditional delegate style, and lambda functions. My go at the traditional syntax is below, but I have gut feeling it should be much simpler than this: Private Sub CollectMesssageBoxResultFromUserAsDelegate(ByVal messageToShow As String, ByRef wasCanceled As Boolean) wasCanceled = False If Windows.Forms.MessageBox.Show(String.Format("{0}{1}Please press [OK] to ignore this error and continue, or [Cancel] to stop here.", messageToShow), "Continue", Windows.Forms.MessageBoxButtons.OKCancel, Windows.Forms.MessageBoxIcon.Exclamation) = Windows.Forms.DialogResult.Cancel Then wasCanceled = True End If End Sub Private Delegate Sub ShowMessageBox(ByVal messageToShow As String, ByRef canceled As Boolean) Private Sub AskUserWhetherToCancel(ByVal message As String, ByVal args As CancelEventArgs) If args Is Nothing Then args = New System.ComponentModel.CancelEventArgs With {.Cancel = False} Dim wasCancelClicked As Boolean Dim firstDelegate As New ShowMessageBox(AddressOf CollectMesssageBoxResultFromUserAsDelegate) '…. Now what?? 'I can’t declare SendOrPostCallback as below: 'Dim myDelegate As New Threading.SendOrPostCallback(AddressOf firstDelegate) End Sub

    Read the article

  • Events raised by BackgroundWorker not executed on expected thread

    - by Topdown
    A winforms dialog is using BackgroundWorker to perform some asynchronous operations with significant success. On occasion, the async process being run by the background worker will need to raise events to the winforms app for user response (a message that asks the user if they wish to cancel), the response of which captured in an CancelEventArgs type of the event. Being an implementation of threading, I would have expected the RaiseEvent of the worker to fire, and then the worker would continue, hence requiring me to pause the worker until the response is received. Instead however, the worker is held to wait for the code executed by the raise event to complete. It seems like method I am calling via the event call is actually on the worker thread used by the background worker, and I am surprised, since I expected to see it on the Main Thread which is where the mainform is running. Also surprisingly, there are no cross thread exceptions thrown. Can somebody please explain why this is not as I expect?

    Read the article

  • Nested flowlayout panel not wrapping

    - by SnOrfus
    I've got a FlowLayoutPanel with properties: Dock = Fill (in a usercontrol) FlowDirection = TopDown WrapContents = false I do it this way so that each item added to the panel gets added to the bottom. The items that I add to this panel are usercontrols which themselves have FlowLayoutPanels on them, however they have the standard behaviour (LeftToRight, WrapContents = true). The problem that I'm having is that the interior usercontrol's FlowLayoutPanel isn't resizing to fill the outer control, but when I set autosizing to true on these controls, then the panel won't wrap its contents - which is a known problem apparently. If it helps visualize what I'm trying to do, it looks like this: ______________________________ | __________________________ | Outer box = exterior flowlayout | |Text____________________| | (TopDown, NoWrap) | | # # # # # # # # # # # #| | | | # # # # | | Interior boxes = usercontrols with text and a | |________________________| | flowlayoutpanel on them | __________________________ | (LeftToRight, Wrap) | |Text____________________| | | | # # # # # # # # # # # #| | # = pictures | | # # | | | |________________________| | |____________________________|

    Read the article

  • Arrow keys and changing control's focus hang the application

    - by sthay
    I have a usercontrol that contains a FlowLayoutPanel (topdown flow) with a bunch of radiobuttons. The control exposes a CheckedChanged event that fires whenever one of the radiobuttons's check changed. My form contains the usercontrol and a textbox. I subscribe the usercontrol's CheckedChanged event and depending on which radiobutton gets checked, I either disable the textbox or put a focus inside the textbox. All this works fine with mouseclick when changing the radiobutton's check state. However, this will hang indefinitely when using the arrow keys. I don't understand why the difference. The following are steps to reproduce the behavior I'm seeing: Create a usercontrol and drop a FlowLayoutPanel control and set its FlowDirection = TopDown. Then add two radiobuttons to the FlowLayoutPanel. Provide an event handler in the usercontrol public event EventHandler CheckedChanged { add { radioButton2.CheckedChanged += value; } remove { radioButton2.CheckedChanged -= value; } } Create a windows form and drop the above user control. Add a textbox and set Enabled to False. Subscribe to the usercontrol's CheckedChanged event as follows private void userControl11_CheckedChanged(object sender, EventArgs e) { textBox1.Select(); } Run. Notice that if you use the mouse to click between the radiobuttons, thing works fine; but it will crash if you use the up/down arrow keys.

    Read the article

  • Passing an objects rotation down through its children

    - by MintyAnt
    In my topdown 2d game you have a player with a sword, like an old Zelda game. The sword is a seperate entity, and its collision box "rotates" around the player like an orbit, but always follows the player wherever he goes. The player and sword both have a vector2 heading. The sword is a weapon object that is attached to the character. In order to allow swinging in a direction, I have the following property inside sword (RotateCopy returns a copy of the mHeading after rotation) public Vector2 Heading { get { return mHeading.RotateCopy(mOwner.Rotation); } } This seems a bit messy to me, and slower than it could be. Is there a better way to "translate" the base/owner component rotations through to whatever component I am using, like this sword? Would using a rotation MATRIX be better? (Curretnly rotates by sin/cos) If so, how can I "add" up the matrices? Thank you.

    Read the article

  • Friction in Box2d

    - by Rosarch
    I am using Box2d for a topdown game. The "ground" is a series of tiles, where each tile is a static body with a sensor shape. Can I make friction take effect for this, even though the objects aren't really "colliding" with the ground? If Box2d won't let me do this, I considered trying to implement my own by detecting what force is currently moving the object, and applying a force opposite to it, but I'm not quite sure how to detect that force.

    Read the article

  • 2D non-tile based map editor

    - by Jonesy
    I am currently developing a relatively simple 2D, topdown oriented adventure game for the iPhone and was wondering what would be the easiest way to create the maps for my game. I figured I would need some kind of visual editor that would give me immediate feedback and would allow me to place all objects in the world exactly where I want them. I could then load the saved representation of the world I create in the editor in my game. So, I am looking for a simple map editor that allows me to do this. All the objects in my game are simply textured rectangles build up from two triangles. All I need to be able to do is position different rectangles/objects in the map, and give them a texture. I am using texture atlases, so it would be useful to be able to assign portions of textures to the objects. I then need to be able to extract all the objects from the saved representation of my maps, together with the name/identifier of the texture(atlas) they use, and the area of the texture atlas. I have looked at some tile-based map editors like Tiled and Ogmo, but they don't seem to be able to do what I want. Any suggestions? EDIT: a more concrete example: something like the GameMaker level editor, but then with added export functionality in a handy format.

    Read the article

  • 2D non-tile based map editor

    - by user5468
    I am currently developing a relatively simple 2D, topdown oriented adventure game for the iPhone and was wondering what would be the easiest way to create the maps for my game. I figured I would need some kind of visual editor that would give me immediate feedback and would allow me to place all objects in the world exactly where I want them. I could then load the saved representation of the world I create in the editor in my game. So, I am looking for a simple map editor that allows me to do this. All the objects in my game are simply textured rectangles build up from two triangles. All I need to be able to do is position different rectangles/objects in the map, and give them a texture. I am using texture atlases, so it would be useful to be able to assign portions of textures to the objects. I then need to be able to extract all the objects from the saved representation of my maps, together with the name/identifier of the texture(atlas) they use, and the area of the texture atlas. I have looked at some tile-based map editors like Tiled and Ogmo, but they don't seem to be able to do what I want. Any suggestions? EDIT: a more concrete example: something like the GameMaker level editor, but then with added export functionality in a handy format.

    Read the article

  • What is the best way to render a 2d game map?

    - by Deukalion
    I know efficiency is key in game programming and I've had some experiences with rendering a "map" earlier but probably not in the best of ways. For a 2D TopDown game: (simply render the textures/tiles of the world, nothing else) Say, you have a map of 1000x1000 (tiles or whatever). If the tile isn't in the view of the camera, it shouldn't be rendered - it's that simple. No need to render a tile that won't be seen. But since you have 1000x1000 objects in your map, or perhaps less you probably don't want to loop through all 1000*1000 tiles just to see if they're suppose to be rendered or not. Question: What is the best way to implement this efficiency? So that it "quickly/quicker" can determine what tiles are suppose to be rendered? Also, I'm not building my game around tiles rendered with a SpriteBatch so there's no rectangles, the shapes can be different sizes and have multiple points, say a curved object of 10 points and a texture inside that shape; Question: How do you determine if this kind of objects is "inside" the View of the camera? It's easy with a 48x48 rectangle, just see if it X+Width or Y+Height is in the view of the camera. Different with multiple points. Simply put, how to manage the code and the data efficiently to not having to run through/loop through a million of objects at the same time.

    Read the article

  • What data should be cached in a multiplayer server, relative to AI and players?

    - by DevilWithin
    In a virtual place, fully network driven, with an arbitrary number of players and an arbitrary number of enemies, what data should be cached in the server memory, in order to optimize smooth AI simulation? Trying to explain, lets say player A sees player B to E, and enemy A to G. Each of those players, see player A, but not necessarily each other. Same applies to enemies. Think of this question from a topdown perspective please. In many cases, for example, when a player shoots his gun, the server handles the sound as a radial "signal" that every other entity within reach "hear" and react upon. Doing these searches all the time for a whole area, containing possibly a lot of unrelated players and enemies, seems to be an issue, when the budget for each AI agent is so small. Should every entity cache whatever enters and exits from its radius of awareness? Is there a great way to trace the entities close by without flooding the memory with such caches? What about other AI related problems that may arise, after assuming the previous one works well? We're talking about environments with possibly hundreds of enemies, a swarm.

    Read the article

  • Fast, accurate 2d collision

    - by Neophyte
    I'm working on a 2d topdown shooter, and now need to go beyond my basic rectangle bounding box collision system. I have large levels with many different sprites, all of which are different shapes and sizes. The textures for the sprites are all square png files with transparent backgrounds, so I also need a way to only have a collision when the player walks into the coloured part of the texture, and not the transparent background. I plan to handle collision as follows: Check if any sprites are in range of the player Do a rect bounding box collision test Do an accurate collision (Where I need help) I don't mind advanced techniques, as I want to get this right with all my requirements in mind, but I'm not sure how to approach this. What techniques or even libraries to try. I know that I will probably need to create and store some kind of shape that accurately represents each sprite minus the transparent background. I've read that per pixel is slow, so given my large levels and number of objects I don't think that would be suitable. I've also looked at Box2d, but haven't been able to find much documentation, or any examples of how to get it up and running with SFML.

    Read the article

  • How can I cleanly and elegantly handle data and dependancies between classes

    - by Neophyte
    I'm working on 2d topdown game in SFML 2, and need to find an elegant way in which everything will work and fit together. Allow me to explain. I have a number of classes that inherit from an abstract base that provides a draw method and an update method to all the classes. In the game loop, I call update and then draw on each class, I imagine this is a pretty common approach. I have classes for tiles, collisions, the player and a resource manager that contains all the tiles/images/textures. Due to the way input works in SFML I decided to have each class handle input (if required) in its update call. Up until now I have been passing in dependencies as needed, for example, in the player class when a movement key is pressed, I call a method on the collision class to check if the position the player wants to move to will be a collision, and only move the player if there is no collision. This works fine for the most part, but I believe it can be done better, I'm just not sure how. I now have more complex things I need to implement, eg: a player is able to walk up to an object on the ground, press a key to pick it up/loot it and it will then show up in inventory. This means that a few things need to happen: Check if the player is in range of a lootable item on keypress, else do not proceed. Find the item. Update the sprite texture on the item from its default texture to a "looted" texture. Update the collision for the item: it might have changed shape or been removed completely. Inventory needs to be updated with the added item. How do I make everything communicate? With my current system I will end up with my classes going out of scope, and method calls to each other all over the place. I could tie up all the classes in one big manager and give each one a reference to the parent manager class, but this seems only slightly better. Any help/advice would be greatly appreciated! If anything is unclear, I'm happy to expand on things.

    Read the article

1