Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Torus abductor ray

Author
Message
Ashley Staggs
16
Years of Service
User Offline
Joined: 18th Sep 2009
Location:
Posted: 19th Sep 2010 17:19
For a game i am making i need to create an abductor ray.

What i have thought of instead of the sterotypical beam of light is a torus object that comes from the ship, the ring radius increases over time and after a certain distance away from the ship, if the user is still holding down the relevant key, another torus will be created. Once the torus is at the 0 point on the y axis it disappears.

This is the key feature of this game and as i am quite new to dbpro i need your help (again) to help me understand how to do this.

I have attached an image of what i am trying to achieve.

Thanks
thenerd
17
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 19th Sep 2010 19:49
In most games, you would not need to detail of a torus, and it would slow your game down because toruses take a large number of polys. I have a few suggestions for you, but first I'm wondering what type of game you are creating...

Ashley Staggs
16
Years of Service
User Offline
Joined: 18th Sep 2009
Location:
Posted: 19th Sep 2010 20:12
its a 3d side scrolling game that focuses around a flying saucer which abducts people.

Pretty much a side scrolling "Destory All Humans"
Sixty Squares
20
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 19th Sep 2010 20:18 Edited at: 19th Sep 2010 20:22
You could use a detailed torus like the one in your screenshot, but that may slow the game down due to high poly count. You might be able to get away with using flat plains with circles drawn on them if you want to save FPS. But either way, here's the easiest way I can think of.

Just load a bunch of torus objects and have them spawn at regular intervals, moving each of them down each loop. If their Y position is less than 0, then hide them. Make sure to show the torus whenever it spawns. The objects would be recycled, so that after the last torus spawns, the first torus is the next to spawn.

First, you would load a bunch of torus objects-- However many you think you might need to have on the screen at any given time. Maybe you would use a certain range of object numbers for this, such as object numbers 100 to 110.

So here you load the torus objects:


Then, you would need to make some sort of countdown timer. You could make it count in seconds (See the Timer() command), but for simplicity's sake I'm going to make it go down by 1 each loop (this variable is called TorusSpawnTime in the code below). When the timer reaches 0, then the timer should go back up to its original number and a torus should spawn. But which torus? This would need to be kept track of using a variable. This variable would hold the current object number of the torus to spawn, and would increase each time a torus spawned (variable is called TorusNumber below). Once it goes over the maximum number (110 in this case), then it should reset back to the lowest number (100 in this case). To spawn a torus, simply position it to the player object's position and show the object.

So this might go before your loop:


And your loop for spawning the torus objects might look like this:


Then, each loop, simply move each torus down by some amount (5 in this case). If the torus' Y position is less than 0, then hide the torus.



Hope this helps


Guns, cinematics, stealth, items and more!
Ashley Staggs
16
Years of Service
User Offline
Joined: 18th Sep 2009
Location:
Posted: 19th Sep 2010 20:31
i agree with both of you. The torus is high poly so it probably wouldnt be a good idea to have it.

Do you have any thoughts on what would make a cool looking abductor ray?

@sixty Squares
your code will not go unused by me. I have a special plan for it
Sven B
21
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 20th Sep 2010 00:40 Edited at: 20th Sep 2010 00:40
Quote: "Do you have any thoughts on what would make a cool looking abductor ray?"


I think the most obvious solution would be either a plain or a (open) cylinder depending on what view you'll be getting mainly (top -> plain, side -> cylinder). Then texture that object with a glow texture

Cheers!
Sven B

Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 20th Sep 2010 02:19
Make a cone and texture it with a vertical scrolling texture of horizontal lines. The lines will appear like rings and they will scroll up the cone as you scroll the texture.

[b]

Login to post a reply

Server time is: 2026-07-22 12:41:11
Your offset time is: 2026-07-22 12:41:11