Help With Static Member Variables

Hey guys, I am writing a game for my final project in CS2, and I need some help.

I am using Win32. I am using bitmaps, and I have come to a point where I am trying to make multiple objects of the same class move independently of each other.

The problem is, to make the object move, the variable that changes has to be static, but if you make the variable static, that means every object of that class will have the same value, so all the sprites are drawn in the same spot.

How do I move a object/bitmap of the same class without using static member variables, or is there a way to make static member variables differ between objects of the same class?

I appreciate all the help, and thank you for looking :)
Last edited on
first, why do you need it to be static? it will retain its current value throughout the lifetime of the object, and iirc it will only be constructed once. however if you really want to make it static, there might be something you can do with unnamed namespaces or something like that. nested classes maybe?
From the sound of your description you want the variable to be at the instance level hence non-static. Each instance of your class will then have a unique position and be drawn in different places from every other instance. Why did you think it had to be static?
Topic archived. No new replies allowed.