|
Page 1 of 1
|
[ 8 posts ] |
|
Lua Coding Help (Random Spinning Directions)
Author |
Message |
Some_stranger
Joined: Thu Apr 23, 2009 6:35 pm Posts: 71
|
Lua Coding Help (Random Spinning Directions)
Ok, So for my Silly Federation I want the Rocket Launcher to be powerful, but go up and down randomly. Not just ---\__Crash but like /\/\/\/\/\/\----Crash So its like Up down curves and random
If anybody at all can refer me to a Wiki For the Lua i'd be grateful. Also if maximdude is on here i ♥♥♥♥ love you man.
|
Fri Jun 26, 2009 8:29 am |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: Lua Coding Help (Random Spinning Directions)
Code: function Create(self) function sinewave(amplitude,wavenumber,angvel,phase) return amplitude * math.sin(wavenumber - angvel + phase / 30); end function sawtooth(x,range,slope) return (x % range) * slope end
self.initialy = self.Pos.Y - 20; end
function Update(self) --self.Pos.Y = self.initialy + sinewave(30,1,math.pi,self.Pos.X); self.Pos.Y = self.initialy + sawtooth(self.Pos.X,100,0.5); end Code: function Create(self) function sinewave(amplitude,wavenumber,angvel,phase) return amplitude * math.sin(wavenumber - angvel + phase / 20); end self.initialy = self.Pos.Y; end
function Update(self) self.Pos.Y = self.initialy + sinewave(40,1,math.pi / 2,self.Pos.X); end Try these out, see what you think. They're not exactly random, but they do go up and down in a fixed way. Adding an element of random-ness would be fairly easy, as well.
|
Fri Jun 26, 2009 8:32 am |
|
|
Some_stranger
Joined: Thu Apr 23, 2009 6:35 pm Posts: 71
|
Re: Lua Coding Help (Random Spinning Directions)
Well ♥♥♥♥ that was fast. And yeah, i just learned to look at stickies so i don't really need anymore lua help. Glad you Could help Greatly though, man your the best around, nothings gonna ever bring you doooowwwnnn.
|
Fri Jun 26, 2009 8:33 am |
|
|
Some_stranger
Joined: Thu Apr 23, 2009 6:35 pm Posts: 71
|
Re: Lua Coding Help (Random Spinning Directions)
Alright Yeah, that works decently except Its now what i'm looking for. I want it to rotate the missile not move it up and down, so basically the rocket will OrienttoVel and just look good.
How would i do that, Lua Docs don't Seem to help, however i'm new to lua and cant really understand.
|
Fri Jun 26, 2009 8:53 am |
|
|
mail2345
Joined: Tue Nov 06, 2007 6:58 am Posts: 2054
|
Re: Lua Coding Help (Random Spinning Directions)
Lua Docs are for the functions. To learn lua itself, the offical lua site has some good tutorials.
|
Fri Jun 26, 2009 8:55 am |
|
|
mail2345
Joined: Tue Nov 06, 2007 6:58 am Posts: 2054
|
Re: Lua Coding Help (Random Spinning Directions)
Lua Docs are for the functions. To learn lua itself, the offical lua site has some good tutorials. EDIT: Also you need to look at the function dump, and read some code, as the lua docs are half arsed.
|
Fri Jun 26, 2009 8:56 am |
|
|
Some_stranger
Joined: Thu Apr 23, 2009 6:35 pm Posts: 71
|
Re: Lua Coding Help (Random Spinning Directions)
Well hey, thanks guys. I've Been Messing with some things and i figure i'll have the thruster rotate on an offset at random. You guys really helped, so thanks.
|
Fri Jun 26, 2009 9:25 am |
|
|
Some_stranger
Joined: Thu Apr 23, 2009 6:35 pm Posts: 71
|
Re: Lua Coding Help (Random Spinning Directions)
Sorry for Double Double Posting, I dont know if thats a problem here, But i guess i Should Show Some of my errm, 'Crap'. Here are my Weapons Its Known as the Badgers Federation, Simply because all of the Cool Animals are taken (Like Bears) Weapons: That would be it for now. Well, Thanks for the help, this can be closed.
|
Fri Jun 26, 2009 9:42 am |
|
|
|
|
Page 1 of 1
|
[ 8 posts ] |
|
Who is online |
Users browsing this forum: No registered users |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|