Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

102 Neutral

About MintyAnt

  • Rank
  1. Hello, I had a few questions while programming trying to re-create Megaman X in XNA (For purposes of teaching myself game development ) I was going to program my player to have different states. Given the current enviroment and/or user input, I would calculate the players current state. Then I would determine what to do programming wise with the given states. For instance, if he is holding down right key, then he is in a moveRight state. Then I say if state == moveRight, pos.x += speed However using one state lead me to a few collisions when I thought it over. What if he is: Moving right Jumping Shooting Thats three states right? Does that mean I should then have 3 current states of a character? Like this: MovementX MovementY Action And each has one the following states MovementX - moveLeft, moveRight, onWall (For wall kicking/gripping. Like megaman x) MovementY - Jumping, Falling, WallKick Action - Shooting, Charging, ChargeShot (Also, should I have the moveLeft and moveRight, or just Move, calculating the direction afterwards?) The second thing was map drawing: Most people seem to draw maps with either small tiles or screen sized tiles. They load up the next tile and loop to that. After it reaches a point, it ditches the first tile and loads the next, and so on. In megaman they have these large maps they scroll through. Is there a way I can just scroll through this whole map, without bogging down my program? Or is it more efficient for me to destruct the map into different game window sized tiles? And finally, how can I give the game some boundaries, like the floors and walls? Do I need to ascociate some kind of data file with the map? Thanks for the help, -Minty
  2. MintyAnt

    How to animate 2D sprites in XNA?

    Yeah its certaintley been a pain :/ I went into gimp and selected the whole sprite as a box, and it gives me the xy, width and height of it, which I wrote in a .txt Then I have a (hack job) parser in my animation class that will retrieve all the frame data for the given animation name, store it in a class object (frame) array which also creates the box to be used in animation. The only thing i'm worried about is everything being drawn incorrectley. If the sprite should have 5 pixel padding on one frame or not... I can easily include another field for something like an anchor point in my .txt file, however I don't really know what the anchor point does (the specifics) As for your program, wouldn't that mean I would have to take all my sprites out of the sprite sheet one at a time, save them as seperate files, then run them through the program? With the exception of doing that, the progam looks pretty awesome, so I downloaded it for future use if that case arises (assuming thats how it works) -Minty
  3. Okay, that makes a whole lot more sense, thank you very much! I will go ahead and use GetData in my programs now that I understand it, thanks again!
  4. Hello, After looking into some image manipulation with xna, i've come out slightley confused. One task I was wanting to do would involve running through all the pixels in a given image, and checking each ones color. After my searching, I feel that I would be somehow using both Texture2D.GetData and some kind of PixelGrabber (The examples I saw for pixel grabbers were in java) However, the programs that grabbed pixels appeared to shove the whole images pixels into a 1 dimensional array. If that were the case, how would they go about reconstructing the image if they wanted, or knowing which pixel they were currentley viewing? Isn't it all basically on one line now? How do I go about getting the pixels? And how does this process work? Thanks, -Minty
  5. MintyAnt

    How to animate 2D sprites in XNA?

    I suppose you are right. Micheal - This is a sprite sheet, not individual images. Regardless, I did learn that using an XML with the sprite sheet can be useful for certain reasons. For instance anchor points and the coordinates of it on the sheet. I will space the sheet out for now, however I may create a tool that will help me do that automatically in the future, as many sprite sheets I come across seem to not be spaced out correctley. Thanks again for all the help
  6. MintyAnt

    How to animate 2D sprites in XNA?

    Hey, Thanks for the reply and the info. The way you describe isn't worth it with the current sprite sheet, as everything is not spread out evenley. To do them all manually would take some time, and I feel there might be a better appraoch (Though I could be wrong!) Heres what I am thinking. I create an XML file with the spritesheet and put in a tag for each animation line. eg. <MegamanRunning></MegamanRunning> <MegamanJumping> etc... Then I have the program run through each sprite of the sheet. This would be done (somehow) using Texture2d's getdata: http://msdn.microsoft.com/en-us/library/bb197084.aspx#Y1019 (Hopefully this method words) I would use this to basically retrieve the current pixel or area, and determine the sprite in it. Then I would have the program extract the whole sprite and save it as binary data (I believe using Binary64 encoding?) into the XML file at the current XML tag (Like megaman running) It would continue to do this until it hit the last sprite/end of the current y axis frame. Then it would go down to the next set of sprites, and so on. After that, I would simply fetch the image data from the XML sheet and paint that whenever I need to. How does this method sound?
  7. Hello there, I recentley picked up XNA and have since been messing around, trying to create a simple 2D sidescroller. As it stands right now, I have a simple sprite (Megaman) just moving around without.. well, making any movement animation. I did the apphub tutorial, and the way they animate is by just having a set distance between each frame of animation, and loading that cell of the animation. However, most all spritesheets I have found do not have an equal ammount of spacing or a standard frame size. For instance, megamans running animation: http://www.sprites-inc.co.uk/files/X/X/ So here are my questions: 1. Is this how animation sheets generally are? If so, how do I program my game to know which is the next frame, and its size? 2. Is there a program I can use that will automatically tile this evenly for me? And on that note... 3. Is there a way I could just create that program myself? The only thing I'd need is a way for XNA to look at every pixel in a program and get its current color (To check if its a blank/opaque space and thus space it out correctly) 4. Is how apphub did the animation the wrong way? If so, what is the right way? Laslty, I consider myself okay at programming, so I'm all for any solution, no matter how complex. Thanks for the help, -Minty
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!