Non-Scrolling Game

edited September 2011 in Help request
Okay, so this thread is here so that I don't have to keep making new threads, since I have lot's of questions. I am using the 08_Physics tutorial as a base for my game. I have the physics worked out and tweaked as I want it.


First question: how do I add a playable character, and how do I program what he'll do? I just need an object that can register keyboard input, and then I need to know where to put the behavior code(when this is pressed, move left, when that is pressed, do that, when nothing is pressed, do some animation).

It looks like MushroomStew linked an input with an action in the config file for MushroomStew:
KEY_UP = Jump
But how do I program "Jump"? where do I put the code to that? 08_Physics did the same thing:
KEY_LEFT = RotateLeft
But I couldn't find how the camera implemented "RotateLeft". Where does the code to these things go?

Comments

  • edited September 2011
    OrxRox wrote:
    Okay, so this thread is here so that I don't have to keep making new threads, since I have lot's of questions. I am using the 08_Physics tutorial as a base for my game. I have the physics worked out and tweaked as I want it.

    Good idea for the thread. As for using the tutorial #8 as a base, I'd suggest to use tutorial #10, #11 or #12 instead as those are stand alone whereas the 9 earlier tutorials are plugins (approach that will not work on some platforms such as iOS).
    First question: how do I add a playable character, and how do I program what he'll do? I just need an object that can register keyboard input, and then I need to know where to put the behavior code(when this is pressed, move left, when that is pressed, do that, when nothing is pressed, do some animation).

    It looks like MushroomStew linked an input with an action in the config file for MushroomStew:
    KEY_UP = Jump
    But how do I program "Jump"? where do I put the code to that? 08_Physics did the same thing:
    KEY_LEFT = RotateLeft
    But I couldn't find how the camera implemented "RotateLeft". Where does the code to these things go?

    First of all, I can only encourage you to check Grey's tutorials if you haven't done so already as he covered those step by step: http://orx-project.org/wiki/en/orx/tutorials/community/grey

    Now, for details, what you need first is an update function. For that, the easiest way is to register one to the main clock.
    You can put all your logic in that function (or in functions called by it). For example, when updating your input, that's where you'll add the calls to orxInput_IsActive() / orxInput_HasNewStatus().

    In the case of tutorial #8, all the code is in /tutorial/src/08_Physics.c

    For Mushroom Stew it's slightly different, it uses Scroll which is a thin C++ layer built on top of orx that adds the concept of modular game object. They come with custom virtual methods such as update but you can achieve the same thing pretty easily with orx itself (after all, Scroll is only a thin layer wrapping orx). The version of Scroll used in Mushroom Stew is outdated and won't even compile with a recent version of orx. I can send you the latest version of Scroll if you want, along some explanations, but it's still a WIP so it might have some bugs and only a handful of people are using it for their development. If you're interested anyway, just drop me a line either by email or with a PM.
Sign In or Register to comment.