Scripting That Works, Using Cameras
by Jesse Jenson · in Torque Game Builder · 05/02/2006 (7:52 pm) · 2 replies
Okay, I may get hazed for asking these questions, and most likely directed to a tutorial that doesn't work with the current build, but perhaps someone might be able to help me...
I'm relatively new to scripting with Torque. Brand new, really. I'm more of a designer by trade, but programmers are hard to come by, so I'm taking over for my company's project. So, this is going to be fantastic. I can already feel the late nights feuled by caffeine. Good times.
Anyway, the first thing is, how the heck does one actually write a script to affect what is going on in the game?
Case in point: I have created a testbed to start working on little sample pieces to get used to scripting. My level is called title.t2d (it's a title screen).
I have clouds on the screen, labeled titlecloud1 and titlecloud2. I can get them to move from within the TGB testbed program by entering "titlecloud1.setlinearvelocityy(-2);" into the terminal, but if I write it within the main.cs file or game.cs file, nothing happens.
I've looked through the docs and am probably missing something fairly obvious, but I'm just not getting it. I want to know WHERE to put my scripting so that it affects the objects on screen. I know how to tinker with the objects, but I just can't get the right placement of the code.
Second, how do I zoom the camera? I've tried using setcurrentcamerazoom(2); and it doesn't work. I'm sure the answer is simple, but it eludes me at the moment.
Thanks for any help,
Jesse
I'm relatively new to scripting with Torque. Brand new, really. I'm more of a designer by trade, but programmers are hard to come by, so I'm taking over for my company's project. So, this is going to be fantastic. I can already feel the late nights feuled by caffeine. Good times.
Anyway, the first thing is, how the heck does one actually write a script to affect what is going on in the game?
Case in point: I have created a testbed to start working on little sample pieces to get used to scripting. My level is called title.t2d (it's a title screen).
I have clouds on the screen, labeled titlecloud1 and titlecloud2. I can get them to move from within the TGB testbed program by entering "titlecloud1.setlinearvelocityy(-2);" into the terminal, but if I write it within the main.cs file or game.cs file, nothing happens.
I've looked through the docs and am probably missing something fairly obvious, but I'm just not getting it. I want to know WHERE to put my scripting so that it affects the objects on screen. I know how to tinker with the objects, but I just can't get the right placement of the code.
Second, how do I zoom the camera? I've tried using setcurrentcamerazoom(2); and it doesn't work. I'm sure the answer is simple, but it eludes me at the moment.
Thanks for any help,
Jesse
About the author
Has spent most of his life working in healthcare and failing at most of his dreams.
#2
05/11/2006 (8:41 pm)
Make sure your camera isn't mounted to anything when you call the zoom function.
Torque Owner Daniel Horton