Data Realms Fan Forums http://45.55.195.193/ |
|
Gun Ship MK1 | Documented so you can learn how to do it! http://45.55.195.193/viewtopic.php?f=61&t=15319 |
Page 1 of 1 |
Author: | Battle_hobo [ Thu Jun 11, 2009 10:20 pm ] | ||
Post subject: | Gun Ship MK1 | Documented so you can learn how to do it! | ||
Well I was searching the other day on the good ol' fan forums for a dropship with a turret on it...But I couldn't find like, any!...So I decided to make one + give a documentary on how it works! This way I am hoping to help get more good mods out there. So yea, this is just a basic Drop Ship MK1 that shoots rockets out of a point below the ship, this uses no custom sprites because this is simply to teach other how to make gunships. btw, feel free to give advice cause this is my first time giving a documentary of tutorial of some kind Edit : OOPS! forgot to say how to fire the rockets Anyways, press F to fire them.
|
Author: | Metal Meltdown [ Thu Jun 11, 2009 10:34 pm ] |
Post subject: | Re: Gun Ship MK1 | Documented so you can learn how to do it! |
BWAHAHAHAHA! Now, we shall have proper doom-raining machines of death! All that's left is for someone to make a flippable dropship and we're all set. |
Author: | mail2345 [ Thu Jun 11, 2009 11:08 pm ] |
Post subject: | Re: Gun Ship MK1 | Documented so you can learn how to do it! |
@above: See grif's plane @OP: That is a lot of documentation. Should be enough so that people with absolutely no programming background can change it. |
Author: | Rawtoast [ Fri Jun 12, 2009 3:43 am ] |
Post subject: | Re: Gun Ship MK1 | Documented so you can learn how to do it! |
Can this go in the template post? |
Author: | mail2345 [ Fri Jun 12, 2009 4:36 am ] |
Post subject: | Re: Gun Ship MK1 | Documented so you can learn how to do it! |
This is not exactly a module. |
Author: | Invalidator [ Fri Jun 12, 2009 4:50 pm ] | ||
Post subject: | Re: Gun Ship MK1 | Documented so you can learn how to do it! | ||
This is an excellent post. A good idea and a good example of how to do it, along with details on how to do it. So, since you asked for advice, I will give it. Your code seems a little inefficient. Your update code is running every frame, which is unnecessary. Only check actors, create rockets, etc when the F key is pressed AND when the timer has reset. It's unnecessary to scan for a new target when you still have a valid target, as well. Just check to see if your current target is valid each frame. You are also running a for loop over every actor twice each frame, which you really do not need. You can get away with running that code once. I've attached suggested optimizations to the code with new comments on the optimizations for anyone to look at. Whoever wants to look at this should understand the first piece of code first. I'm sure there are even further optimizations that could be performed on the code, but that's the nature of programming.
|
Author: | Battle_hobo [ Fri Jun 12, 2009 5:05 pm ] |
Post subject: | Re: Gun Ship MK1 | Documented so you can learn how to do it! |
Hey thanks, I guess I need to learn more coding myself then |
Author: | Invalidator [ Fri Jun 12, 2009 5:48 pm ] |
Post subject: | Re: Gun Ship MK1 | Documented so you can learn how to do it! |
You still got it to work though, and taught some people more about coding. That deserves at least one Kudos. That's the real advantage of communities like this, everyone gets to learn from everyone! |
Author: | mail2345 [ Fri Jun 12, 2009 7:18 pm ] | ||
Post subject: | Re: Gun Ship MK1 | Documented so you can learn how to do it! | ||
This forum will probably never have a rep system, btw. Anyway, I've optimized the optimized code even more. Primarily the conditionals. Remember, lua has short circuited logic, so put the things that will most likely end the statement's processing first.
|
Author: | Invalidator [ Sat Jun 13, 2009 6:36 pm ] |
Post subject: | Re: Gun Ship MK1 | Documented so you can learn how to do it! |
mail2345 wrote: Remember, lua has short circuited logic, so put the things that will most likely end the statement's processing first. True, and good catch. |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |