ZeHa
04-23-2007, 09:19 AM
Hello,
at the moment, I'm planning a flexible game engine that serves my needs and can be scripted. That way I hope to create future games more easily with my own tools, trying not to touch the engine code itself too frequently.
But now I've got a little design problem, because I'm not sure about the proper way to implement it. And I want it to be made properly, as I want a clean engine, and I don't want to hack around (yet :D ).
Okay, enough introduction :) now the technical part:
Imagine you play a tile-based game, and you walk around some static floor tiles, but then you cross an "assembly line" that influences your moving direction. Now the influence direction should be added to your normal moving direction that you can control with the keyboard.
I use a vector for that, so my idea would be to give the Entity class a "normal direction" (or concious direction or call it whatever you wish :) ), and an "external influence direction". When the Entity's position would be calculated for rendering or collision check, both directions would be simply added.
But would that be the "correct way"? I never did something like that, I only had ONE direction variable and now there would be two, so it feels a little uncomfortable for me on first sight.
Are there any other possibilities, that I didn't think of yet, but have "superior correctness"? :)
at the moment, I'm planning a flexible game engine that serves my needs and can be scripted. That way I hope to create future games more easily with my own tools, trying not to touch the engine code itself too frequently.
But now I've got a little design problem, because I'm not sure about the proper way to implement it. And I want it to be made properly, as I want a clean engine, and I don't want to hack around (yet :D ).
Okay, enough introduction :) now the technical part:
Imagine you play a tile-based game, and you walk around some static floor tiles, but then you cross an "assembly line" that influences your moving direction. Now the influence direction should be added to your normal moving direction that you can control with the keyboard.
I use a vector for that, so my idea would be to give the Entity class a "normal direction" (or concious direction or call it whatever you wish :) ), and an "external influence direction". When the Entity's position would be calculated for rendering or collision check, both directions would be simply added.
But would that be the "correct way"? I never did something like that, I only had ONE direction variable and now there would be two, so it feels a little uncomfortable for me on first sight.
Are there any other possibilities, that I didn't think of yet, but have "superior correctness"? :)