[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Fun with scripting and LUA! (Can't wrap head around concepts!)
- From: "Gary Popov" <insidetheasylum@...>
- Date: Mon, 28 Aug 2006 23:59:34 -0500
Hi guys, I have a question about scripting. I haven't been programming all that long and I've never done any sort of scripting before, so please be gentle with me. I'm also pretty dense. LUA came recommended to me and with the few examples that I've seen, it looked fairly easy to integrate to work with c++ and supposedly fairly fast which is why I chose it.
Anyway, on to the background of the question -- I have a small 3d game to which I want to add some moving platforms. The platforms, for now, I just want to move in fairly linear fashion, but I want to be able to modify them to rotate and so on in the future. Basically, what I want to be able to do is
a) Load the platfoms as part of a level
b) specify the waypoints to which the platforms have to travel
c) Able to specify the speeds and so on between waypoints.
d) Have the platforms stop (or start moving, if stopped) if some trigger was set off.
Furthermore, my question -- What kind of functions should I have in my engine's api, how should I specify the movement/rotation of each platform, and what should my scripts look like.
So for an example... if I had two points, A(0,0,0) and b(10,0,0).. I want..
a) For a platform to move from A to B and take 5 seconds while doing it.
b) For the platform to move from B to A and take 5 seconds while doing it.
c) Repeat that forever.
That's for a simple example, how about something like...
a) Wait for a trigger to be activated/condition set to true
b) Move platform from A to B, take 5 seconds to do it
c) Rotate the platform along the Y axis 360 degrees while moving from A to B.
d) Stop at B (until a trigger, perhaps a trigger on the side of the platform on which the person travelled makes it go back)
I'm using Ogre3d and since I'm afraid of threads, everything, rendering, physics, etc, is all done in one thread. If anyone could help me, I'd really appreciate it.
By the way, this is what I have so far --
http://youtube.com/watch?v=1tMedZ6192k
Unfortunately, all of the way points and movement of the platforms is hardcoded into the executible which is .. no good considering I want to be able to load in different levels and also be able to mix-and-match different movements as I pointed out in my examples without having to special case-by-case code for each platform.
Thanks, Gary