2D Game Primer (Visual C#)

Sign in to queue

The Discussion

  • User profile image
    Pixelbath

    kenren: Just like you'd do collision detection, only you'd check for collision on the MouseUp event, rather than every iteration.

    You're welcome in post mortem.

  • User profile image
    Website Scripts » Coding4Fun : Upgrade Your Game: Crusader (C#)
  • User profile image
    Software Information » Coding4Fun : 2D Game Primer (Visual C#)
  • User profile image
    Adam D

    This series of posts has been brilliant. As a beginner to games programming I've had many an 'ahha!' moment reading them. Well done and thanks.

  • User profile image
    Langford

    The paragraph explaining how you move a sprite by its velocity, multiplied by the time elapsed since the last 'frame': Best explanation I've heard on that subject, in any OOP language lol.

  • User profile image
    Guillermo

    It was very educational! can you send me some c++ code for games, thanks

  • User profile image
    Clint

    The wonders of having Coding4Fun moved from one medium to another.

    On it, thanks for the heads up.

  • User profile image
    jimi hendrix

    why are the links to the tutorial on top not working???

  • User profile image
    Ariful Ambia Noman

    very usefully article. I like it.

  • User profile image
    Loendal

    Any progress on when we might see the diagrams and images again?  This primer was very thourough and I'd love to put it to practice..

  • User profile image
    Clint

    Welcome to the Upgrade Your Game series of tutorials. In this article, we will develop a role-playing

  • User profile image
    Clint

    fixed, thanks for telling me about the links.  They broke when we moved the site over to the blogs.msdn.com platform

  • User profile image
    Coding4Fun : 2D Game Primer (Visual C#)
  • User profile image
    Greg

    Doesn't this cause alot of paint events to occur?  Each time the paint event fires it schedules another one by calling Invalidate.  Since the sprite movement is timer based, that occurs infrequently, so most of the time it's refreshing the screen for no reason.

  • User profile image
    Lex

    it can be solved, by adding a variable which indicates which objects needed to be painted again

  • User profile image
    Someone

    Hey, I created my own shooter Sprite for the SpaceBlitz starter kit, where could I find information on how to add my image in place of the default spaceship?

  • User profile image
    Clint

    @Somone, You can also do it without replacing/deleting, or otherwise manipulating the image.

    Go to the project and look for the .png that represents the one you want to change. For example if it is “ship.png” then that’s the one you want. Don’t do anything to it.

    Then take your new one – hopefully it is the same size or it could cause some minor issues if the size was used in calculations – and add it to the Content project in the same place as ship.png. Make sure to do add existing item in VS, don’t just copy it, or if you do make sure to include in project.

    Then, do a project wide search for “ship.png” or whatever the old one is called. Find the line where it says, something = Content.Load<Texture2D>(“some path\ship”); (note there is NO png file extension in the code!!)

    Comment that line out, copy and paste it below, and replace “ship” with the filename of your new one (no extension)

  • User profile image
    Clint

    @Someone, That is something you should be able to figure out on your own Smiley

  • User profile image
    Clint

    @Someone, That is something you should be able to figure out on your own Smiley

  • User profile image
    Someone

    Thank you so MUCH!!! Now, if you could show me the best way to icrease the number of bombs you ( and the Aliens ) can drop without having to wait for them to be removed from the screen, you would be a lifesaver  

  • User profile image
    Someone

    Ok, I've spent the last week working on my problem. I'm working on a system that limits the number of missiles in the game using similar methods to the ones used to limit the number of lives, but the  problem is that the missiles are not being removed from the screen until I another missile is fired (although the missile is no longer visible) this results in the aliens being destroyed one after another as they run into the invisible missile. Another problem I am having is that no matter how many missiles are on the screen, only the last one fired does any damaqe to the aliens ( In other word all except the last missile pass through lines and lines of aliens without doing a lick of damage ). Thanks for all the help.

  • User profile image
    Clint

    @Someone why don't you have a missle counter.  You add one when you fire it, subtract when one hits something or is off the screen.

    in your firing function, say "if (_currentMisslesOnScreen < MaxAmountOfMisslesOnScreen) { fireMissle(); _currentMisslesOnScreen++;}

  • User profile image
    jh1507

    Wow,

    I`m a kid and i sorta get it!

    (I program in C#)

    It makes sence about the volocity

    x,y cordinites etc.

    Good Tutorial!

  • User profile image
    jh1507

    But...

    I sorta got throw on pong when i look at the code to me it`s very confussing! can you please recomend any other free C# 2D Tutorials? Please.

    Anyway i found the 2D game primer a good intro...

  • User profile image
    Someone

    In reply to your last message I first want to make my situation understood. First, I created a bomb counter system similar to the one you discribed ( similar because I don't know what all that fireMissile() method would intail) Secondly, no matter how many bombs are on the screen at one time, ONLY the last bomb ( Ithe order they were dropped) does any damage to either the bases or the baseship. Finally, I am tring to make the aliens drop two bombs simultaneously at all times ,but what is currently happening is that two bombs are dropped roughly at the same time ( I have the random factor set to zero) the first of the two making no impression on anything it runs into ( speaking again of the last one fired being the only one that does any damage) ,and after both have disappeared it begins dropping bombs only one at a time. Thank you for all the time you have spent answering my questions; This has been wonderful resource.

Add Your 2 Cents