Change the range of config-file vectors

edited February 2011 in Help request
I've got a particle system spawning snowflakes at the right edge of the game screen; they then blow across towards the left. Therefore, in the config file, the snowflake particles are given a random position, somewhere between the top and bottom of the screen:
Color = (150, 150, 150)
Alpha = 0.6 ~ 0.7
Position = (0, -300, -0.5) ~ (0, 300, 0.5)
Speed = (-400, 0, 0) ~ (-500, 0, 0)

Now, my game will be fullscreen at the player's native desktop resolution (I previously got that working with the SVN build of Orx, with some troubleshooting mentioned here). Since different players will have different screen sizes, I'd like to ensure that the snow particles spawn in the appropriate range.

Is there any way to change the random range of an object at run-time?


  • edited February 2011
    Well, there are two things you can do for that. First, your camera isn't bound to your screen resolution. Its frustum can be fixed, meaning that the camera will alway see the same part of the world no matter what the screen resolution is. That might induce automatic behind the scene up/down-scaling. The big issue there is the aspect ratio which is fixed and will result in letter boxing.
    This is fine with most 2D games as sprites don't like being distorted anyway (UI has even more problems, but in orx they can be placed with relative coordinates).
    The positive part is that all your coordinates are in world space and don't need to be adapted.

    If it's not the case, and you want to support different aspect ratios/resolutions, you can then change your object properties at runtime. So as to prevent the randomness, you can do it at loading time, when you know the screen size (orxDisplay_GetScreenSize) and replace the config value (orxConfig_Push/Set/Pop).
Sign In or Register to comment.