Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8496625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:54:20+00:00 2026-06-10T23:54:20+00:00

In my game I have a header file that contains properties and functions for

  • 0

In my game I have a header file that contains properties and functions for seasons in my game. These properties are all static and include a float representing the current season and another float representing the current point in the transition between seasons, being zero if it isn’t transitioning.

Several functions throughout my game rely on the transition (two at this point) and one is working perfectly. Although, in another instance this isn’t working at all.

In the class responsible for controlling the background for my game, when ever the “SeasonTransition” variable is referenced it just comes up zero. But in the other class, where the variable is referenced exactly the same way, it comes up with the real value.

This is a picture after a breakpoint has been called after the game could update a few frames:
enter image description here

Once again these variables are declared in a c header file:

#import "somestuff.h"

static float SeasonTransition
etc...

This shouldn’t be doing this right? How could I fix this?

EDIT:

The Season.h file is as follows:

//GL.h contains different functions and global variables to be used anywhere in the project.
//This file, like Season.h is a singular header file with static declarations, and is setup
//the same way. I have been developing this from the start of the project and havent had any
//problems with it.
#import "GL.h"

static float currentSeason;

static float SeasonTransition;

static void UpdateSeason(){
    currentSeason += 0.0002f;

    float TransitionLength = 0.15f;
    float SeasonDepth = Clamp(currentSeason - floorf(currentSeason), 0, TransitionLength);
    float bigTL = TransitionLength / 4;
    float endTL = TransitionLength;
    float Speed2 = 0;
    float Speed1 = 1;
    float bRatio = SeasonDepth / bigTL;
    float eRatio = SeasonDepth / endTL;

    SeasonTransition = (SeasonDepth < TransitionLength) ?
    ((SeasonDepth < bigTL) ?
     (Speed1 * bRatio) + (Speed2 * (1.0f - bRatio)) :
     (Speed1 * (1.0f - eRatio)) + (Speed2 * eRatio))

    :

    Speed2;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T23:54:21+00:00Added an answer on June 10, 2026 at 11:54 pm

    I could be wrong but I think the problem might be you don’t quit understand how include/import work. These are not quit language features but preprocessor feature. When you include somewhere in a file, your say take the entire contents of that other file and stick it in here before your start compiling. So if you include the same header file in multiple different other files you will end up with multiple version of that static variable, with out the static you will get a compiler error because you have redefined the same variable multiple times. import works almost the same except if the preprocessor determines that the included file has already be include into the destination file (could be indirectly through another include), then it will not include the file again. If you understand this you can then see that declaring static variable within you header is quit strange, because you will end up with multiple versions of that variable everywhere that header is included. Normally you want to make the variable global in which case you define it in a .c or .m file and then declare it extern in the header or you want the variable to be private then you declare it static in the .c or .m file.

    What static does is to hide the variable declaration from the linker, so the linker can not recognise that all the different declarations of the same name should be treated as the same variable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a header file for a game that declares a two-dimensional array for
I have a couple of Python functions that I use to make game development
My game units have an angle variable, and a targetAngle variable. These variables range
In my game I have a concept of resource manager, a class that stores
Update The reason I couldn't update properly was I didn't have game's jar file
I have the following header file: #ifndef CLASSES_H #define CLASSES_H class Mouse // Handles
I'm developing a game. I have a header GameSystem (just methods like the game
I have enum declared in a header file called sm.h enum GameStates { STATE_NULL
I have a variable declared in the header file : @interface int _nPerfectSlides; and
I have a (many) .dgp files, which is an image file that I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.