Jump to content
  • Advertisement

Diirewolf

Member
  • Content Count

    27
  • Joined

  • Last visited

Community Reputation

122 Neutral

About Diirewolf

  • Rank
    Member
  1. Diirewolf

    C++ Class Library with Visual Studio

    Ok this article says how to make dll from a win32 console application. What i want to do is create a class library with classes etc. which I can use inside a win32 console app. How can I do this?
  2. Diirewolf

    C++ Class Library with Visual Studio

    Thanks I think this is what i'm looking for. I'll try it out. Thanks again
  3. Alright I use Visual Studio (2005) for C/C++ and C# programming. I want to know how to program a c++ class library using Visual Studio. I know how to do this in C# and I know how to use the compiled library in my programs. How do I do this in C++. All I get when I compile is a .dll file and I dont know how to use this in my C++ programs. Also what would be an easy way to test the library. In C# all you need to do is reference a class library project or a .dll and you're good to go. How would I do something similar to this in C++? Please help Thanks
  4. Diirewolf

    Simple collision detection for sidescroller

    The way i'm doing it now is simple SAT only rectangles: public enum Direction { None, Left, Top, Right, Bottom } public static class Collision{ public static bool RectsAreColliding(Rectangle r1, Rectangle, r2) { return (!((r1.Right < r2.Left) || (r1.Left > r2.Right) || (r1.Bottom < r2.Top) || (r1.Top > r2.Bottom))); } public static Direction SpriteRectXCollision(Sprite sprite, Rectangle rect/*probably a tile*/) { if (!RectsAreColliding(sprite.SpriteRectangle, rect)) { return Direction.None; } if (sprite.VelocityX > 0) { return Direction.Right; } else if (sprite.VelocityX < 0) { return Direction.Left; } return Direction.None; } public static Direction SpriteRectYCollision(Sprite sprite, Rectangle rect/*probably a tile*/) { if (!RectsAreColliding(sprite.SpriteRectangle, rect)) { return Direction.None; } if (sprite.VelocityY > 0) { return Direction.Bottom; } else if (sprite.VelocityY < 0) { return Direction.Top; } return Direction.None; } } Pretty optimized I think and it works perfectly.
  5. You see i'm not a beginner in game programming. I have made a few games before just based on DirectX, no game engine. Now that i've started a project, I thought it would be good to make a game engine so that I can use in the project and in other projects in the future. I just need some help with developing the engine. thanks
  6. Ive heard about XNA but I would prefer at least for now to stick with Managed DirectX as I am familiar with it. Also I want to make a 2d game engine because I am planning to make a few games (one a sidescroller and one a turn-based RPG and possibly more in the future). thanks
  7. Im currently programming a 2d game engine with C# and Managed DirectX. I have made the engine but it doesnt seem to be really helpfull for me when im writing a game... can someone please point me in the right direction as to how to make a successfull 2d game engine in c#? thanks
  8. Diirewolf

    Simple collision detection for sidescroller

    What is the advantage of using SAT method vs Normal method (the one that Sirisian used)?
  9. Diirewolf

    Simple collision detection for sidescroller

    I understand Sirisian's method and I just wrote up a quick GDI test and it works like a charm. I have read on SAT and I dont know if it would be smart to use it in a sidescroller. You think its worth learning and implementing it into a sidescroller? thanks
  10. Ive been working for awhile on a sidescroller and I was wondering what is the best way to do collision detection. I'm using C# with Managed DirectX, my game is pretty simple. I have a Sprite class, Tiles are just Rectangles and are organized into a List<Tile> variable for a level. I have a static class Collision which has some collision functions. Currently I just have a function SpriteSpriteCollision(Sprite s1, sprite s2) which returns a Direction (ie. the direction that s1 is in terms of s2). My code checks if the SpriteOldRectangle of s1 is on the left, top, right or bottom of s2 and returns a Direction based on that. Of couse I check if the 2 sprites are colliding first. Now I'm not sure if my way of doing the collision detection is right, in fact im sure there is a better way to do it. Also with my way the collision response doesn't work well most of the time. Can someone explain to me the best way to do collision detection (and respose) in a sidescroller game. note i dont want pixel accurate collision detection (at least not yet :) ). Thanks
  11. so the only way to do it would be to have separate variables for animation update and movement update ie. float lastAnimUpdate; float lastMoveUpdate; I saw another game do it in a different way but i dont remember how. Are you sure this is the only way to do it? thx
  12. ok im not sure if this is in the right section of the forums... anywayz im coding a 2d engine using C# and Managed DirectX. My problem is with timing. First I have my timer class set up (copied from mdxutil.cs in the DirectX SDK). It works fine. Now my problem is how do I use the timer. Ok first of all, I have a Sprite class with an Update(double absoluteTime) method. ok now I call this in my game loop and pass the absolute time to every sprite. Now lets say I want the sprite to move (according to its velocity) 5 times a second, and I want it to go to the next frame of animation every 2 times a second. How would I use the timer to accomplish this? thanks
  13. Diirewolf

    2D animation

    I use DirectX, but my technique was derived from an SDL tutorial so it should work. You have 2 classes: Sprite and SpriteBase. SpriteBase is loaded from a text file, and one of these is created for each different Sprite Image. ie. You will have a text file for each Image file you want to load, and in the text file you will give the image name, and animation data. for each animation, i put a number of frames and each frame contains a Rectangle to use as a source from the image. The sprite class contains a reference to a spritebase. The sprite class contains sprite independant data ie. current animation etc. This way you can create 1000 sprites based on a single spritebase. Each update of the sprites will call currentanimation.update(); that will decide if the next frame is to be set depending on speed (set in the text file of a spritebase). I found this technique extremely effective in my C# Managed DirectX games. good luck.
  14. Diirewolf

    Pure game programming...

    Any other suggestions? I am trying to get the Game Coding All in One, but I can't seem to find it anywhere.
  15. well my engine doesnt use messages, and it works fine. Heres how it works: in the engine, you have these classes: -CoreGame (abstract) -GameState (abstract) -Graphics -Texture -TextureManager -SpriteBase -Sprite -Animation -Timer (static) The game state has abstract functions Draw and Update, also input functions liek OnKeyDown etc. When any of these events happen, the core engine calls these functions to the current GameState. Each game state has a ref to the CoreGame, and through this the GameStates can get the window, graphics and texturemanager. Using these each GameState can load its own textures, draw its own stuff etc. SpriteBase is not specific to one sprite, it contains a ref to an image file, and animation data. So if you want to create 5 sprites using the same image and same animations, then u would create it with a ref to the SpriteBase. The sprite has Draw and Update methods, which u can easily use to Update and Draw each sprite... The TextureManager loads Textures, and disposes of them once the Game, or GameState is finished running. To make a game, you need to inherit CoreGame and make at least one GameState. Then in the initializer of your Game, you would call ChangeGameState(new whateverGameState); and Run(); As you see my engine doesnt use messages and i think this simplifies things a lot. You are definately over-engineering. Let me know if this helped or if i went off track.
  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!