2D Game Dev – Part 8.3: Sprite Struct Gravity Demo

This post is a portion of Part 8 in my on going series about 2D Game Development using the Allegro 5 library. These posts are in course order. You can see all of the posts in this course by clicking the “2D Game Development” button at the top of this site.

In this last video of Part 8, we are going to look at taking our Sprite Demo’s a step further. We will program an application that moves sprites around the screen while simulating a gravitation pull. What I mean by that is that each object will be attracted to every other object. The result will be sprites that all move relative to each other. It is pretty neat!

Full source can be found here.

Posted in 2D Game Dev, Allegro, C++, Code, Game Dev, Part 8, Tutorial
10 Comments » for 2D Game Dev – Part 8.3: Sprite Struct Gravity Demo
  1. doc says:

    Can u give me “space-core.png” file.
    Thank U
    :D

  2. Mike says:

    I mention where to find it in the videos. I cannot give it to you as it is not mine to give. Go to the website I show in the video and get it from there.

  3. doc says:

    Ok, thank u :D

  4. Matthew says:

    Freaking neat!

  5. Fengchang says:

    Hello mike, how about you add more notes in the source file , although your videos are pretty cool, but sometimes when i just wanna save some time and skip the video, just read the code, i find it weird without enough notes, thank you very much….

    • Mike says:

      I would prefer not to double up on work. The source code is meant to assist with the video learning, not the other way around. I would recommend not skipping the videos if you are having a hard time understanding the code without notes.

  6. Thomas says:

    Wow, what a great tutorial! Thanks a bunch, kind believe I have actually just coded and compiled something like this :D

  7. James says:

    Hi Mike, loving the series! It’s really helping with my Procedural Programming course!

    My question is how would I go about implementing this into a platformer? So that a character will jump naturally with gravitational affects.

  8. Lanatir says:

    Hey Mike, the “FPS” count being shown on the screen in the downloadable code is instead a “TEPS” (Timer Events Per Second) count because it is incremented inside the processing of the timer event and not where the frames are being drawn. The current logic WILL fail to translate to the count of “FPS” under high load (or on a computer with very limited graphics processing) because of this flaw.

    I’m very happy with the tutorials that you are doing and I look forward to finishing them as I update and complete the final project from my game programming class 5 years ago. Thanks for your time and effort!

    • Mike says:

      Your comment has been updated with the clearer information. Sorry for the miscommunication. You are correct. I am using the term “FPS” incorrectly, as my intention is to show update frames, not actual rendering frames. I just opted to use the term “FPS”.

      Thanks for the comment

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>