Adding shooting and aiming
by Henry Garle · in Torque X Platformer Kit · 10/19/2007 (1:03 pm) · 21 replies
Ive recently just finished writing a few modifications that enable the player to shoot bullets in 360 degrees depending where the aimer is pointed. If there is enough intrest here ill post it ... so if you would like the code just post here and ill host it and the other resources needed for it :)
Henry
Henry
About the author
#2
10/19/2007 (2:02 pm)
If you feel up to it, you could post it directly to Torque Developer's Network. :)
#3
Hopefully it will be up to standard, if anyone has a chance to look over it once its done that would be great.
Henry
10/19/2007 (2:43 pm)
Sure ill do that tomorow!Hopefully it will be up to standard, if anyone has a chance to look over it once its done that would be great.
Henry
#4
tdn.garagegames.com/wiki/TorqueX/PlatformerFrameworkShooter
10/19/2007 (11:53 pm)
Ok its posted up at:tdn.garagegames.com/wiki/TorqueX/PlatformerFrameworkShooter
#5
Anyway ... The code has been dramaticly cleaned up and reduced to an almost embarasing amount. Just updating it now!
Shame the comunity seems a little stale at the moment, probably wont help many people out.
Henry
10/21/2007 (2:33 pm)
Ok ive just re-written it in a way that is far better. For instance now if you push the stick to the bottom right, thats where it will aim not just spin around. Why the hell didnt i look at the other examples before i did this?!Anyway ... The code has been dramaticly cleaned up and reduced to an almost embarasing amount. Just updating it now!
Shame the comunity seems a little stale at the moment, probably wont help many people out.
Henry
#6
Far from it! I've been longing for this since I began to experiment with the Platformer Kit.
But I'm new to XNA and still have to learn and copy a lot of coding from experienced programmers like you!
I will test and implement your GREAT work in my current Torque X project as soon as possible!
Thank you very much for this contribution!
10/22/2007 (4:16 am)
Quote:Shame the comunity seems a little stale at the moment, probably wont help many people out.
Far from it! I've been longing for this since I began to experiment with the Platformer Kit.
But I'm new to XNA and still have to learn and copy a lot of coding from experienced programmers like you!
I will test and implement your GREAT work in my current Torque X project as soon as possible!
Thank you very much for this contribution!
#7
10/22/2007 (8:25 am)
Nice write-up!
#8
10/22/2007 (10:22 am)
Glad you all aprove!
#9
What do you mean with "Add the object to the dragon"?
Does this mean to mount it to the dragon? To the DragonPuppet or the Player?
10/22/2007 (1:40 pm)
I tested it but I seem to make some n00b mistakes because I get errors or strange behaviours of the projectiles and the aimer...Quote:Add the newly created object, "aimer", to the dragon that is by default already added into the scene.
What do you mean with "Add the object to the dragon"?
Does this mean to mount it to the dragon? To the DragonPuppet or the Player?
#10
Henry
10/22/2007 (1:52 pm)
Add it to the object "Player" mount it at the top of the object, re attatch the Puppet and then move the mount point back down to the middle, because your attatching so many objects at once it gets a bit confused with which object and layer your attatching to so thats how i got around the problem. If this makes no sence, which ... i dont think it does ill nock up a quick video for you to show you. Just reply back :)Henry
#11
the only detail that i don't understand:"move the mount point back down to the middle".
a short video would be cool, of course :)
10/22/2007 (2:46 pm)
Great! it works!the only detail that i don't understand:"move the mount point back down to the middle".
a short video would be cool, of course :)
#12
Also thanks for the credit.
10/22/2007 (6:55 pm)
Great tutorial, I'll be adding this to my game. Also thanks for the credit.
#13
10/23/2007 (4:48 pm)
For some reason this doesn't work ...
#14
I tested it and it works fine :-)
I also solved this "move the mount point back down to the middle"-thing after I said Vista good-bye (what I wanted to do anyway and this solved many of my other problems). Under XP I can move these points, though I cannot delete them with a right-click.
One little detail: I tried to "align" the projectiles with the crosshair, because the bullets leave the player above or below the aimer, but I didn't succeed. Does this make sense or shall I attach an screenie?
10/24/2007 (2:45 am)
@HenryI tested it and it works fine :-)
I also solved this "move the mount point back down to the middle"-thing after I said Vista good-bye (what I wanted to do anyway and this solved many of my other problems). Under XP I can move these points, though I cannot delete them with a right-click.
One little detail: I tried to "align" the projectiles with the crosshair, because the bullets leave the player above or below the aimer, but I didn't succeed. Does this make sense or shall I attach an screenie?
#16
I have to pay you a compliment.
I went through the code and it's very "beautiful" :-)
Reduced to the max!
I will definitely use this in my current project though I (or another more talented coder) will have to add some features because after shooting for a while, my scene is crowded with bullets that are flying around because they were trapped or reflected in corners and objects:
- The projectiles must be "killed" after some seconds and not only when they leave the world/scene.
- There must be an inventory system or something similar (ammo pick-up, power-up etc.) so that the player cannot shoot permanently or with unlimited ammo.
10/24/2007 (3:54 am)
@HenryI have to pay you a compliment.
I went through the code and it's very "beautiful" :-)
Reduced to the max!
I will definitely use this in my current project though I (or another more talented coder) will have to add some features because after shooting for a while, my scene is crowded with bullets that are flying around because they were trapped or reflected in corners and objects:
- The projectiles must be "killed" after some seconds and not only when they leave the world/scene.
- There must be an inventory system or something similar (ammo pick-up, power-up etc.) so that the player cannot shoot permanently or with unlimited ammo.
#17
@Zilla, Check in the General forums for Torque X (Not platformer) and you'll see in one of my topics an inventory system that someone else coded. It has to be expanded though.
10/24/2007 (7:23 am)
@Henry, I didn't get what to do before the first code with the new objects and stuff. It's not clear enough.@Zilla, Check in the General forums for Torque X (Not platformer) and you'll see in one of my topics an inventory system that someone else coded. It has to be expanded though.
#18
I know its a bit poor at the moment dro, i will put up some screenshots explaining once i have finished writing an essay that due in tomorow ;)
Henry
10/24/2007 (7:26 am)
Zilla, to sort the problem with the bullets just set a lifetime on them or set their physics mode to "kill". Which means when they hit the ywill remove themselfs and you wont end up with lag.I know its a bit poor at the moment dro, i will put up some screenshots explaining once i have finished writing an essay that due in tomorow ;)
Henry
#19
1. How can I set a lifetime to the bullets?
2. I know that I can set WorldLimitResolveCollision to "KillCollision", which will remove the objects when they cross the border of the world boundaries. Do you mean this or is there another way?
@Dro
I know this thread and I already have bookmarked it for future studies. Thank you!
10/24/2007 (12:12 pm)
@Henry1. How can I set a lifetime to the bullets?
2. I know that I can set WorldLimitResolveCollision to "KillCollision", which will remove the objects when they cross the border of the world boundaries. Do you mean this or is there another way?
@Dro
I know this thread and I already have bookmarked it for future studies. Thank you!
#20
I can't wait :). Would you mind if I clean up some stuff on that wiki page afterwards?
PS: I hate essays :)
@Zilla
;)
10/24/2007 (7:37 pm)
@Henry I can't wait :). Would you mind if I clean up some stuff on that wiki page afterwards?
PS: I hate essays :)
@Zilla
;)
Associate David Montgomery-Blake
David MontgomeryBlake