Game Development Community

Soldat/Abuse/Etc Aiming

by Matt Hughson · in Torque Game Engine · 03/08/2006 (6:08 pm) · 3 replies

Hey Guys,

I am working on a 2.5D action shooter in the same vein as games like Contra, using TGE. I have reached the point where I would like to implement proper aiming. This should work the same as games like Abuse and Soldat, where the player (viewed from a 3rd person, 2.5D perspective) moves a reticule with the mouse.

I have searched quite extensivly through this site, but could not find much. I did come very close with this thread.

That is basically exactly what I want to do! But I have no idea how to implement it :S I was hoping that the updateAim( ) function was already implemented somewhere, and I would just be making changes. And unfourtunetly the sample code doesn't have the class name scoping in the method, so I don't know where to add it from scratch either.

So I'm wondering if someone with more Torque experience (I'm just getting started here) can kind of backwards engineer this, and give some idea of how it would be used. I mean the scripting itself makes sense to me, it's really just how/where should this be called from?

Any source code (even psedo) would be amazing!

Thanks sooo much guys!
Matt

EDIT: Although it looks like the guy who posted that other thread is not still an active member, I was thinking he might be able to give me some pointers. Is there a way to get contact information for forum members? I search but couldn't find any info, so I have to assume no?

#1
03/08/2006 (7:52 pm)
I think you just copy and paste it into default.bind.cs, then change yaw and pitch functions to call it. I haven't tested that, its just a 1st guess.
#2
03/08/2006 (9:07 pm)
Thanks Paul, I am giving that a try but running into a couple problems:

1)
%headRot = player().getHeadRotation();
The console says "Unable to find function Player()". I did some searches and don't see it defined anywhere. Does that mean this guy that function? Any examples of what it might look like? I assume it is like a getPlayer function.

2)
$mvYaw = mPI();
This function (and the other math functions I'm guessing) also appears to be undefined. I imagine there is a math library or something somewhere, but right now my biggest problem is that head rotation stuff so I haven't spent to much time on this.

3)
$faceDir = "Right";
This does not seem to have any effect on the direction the player faces.

4) Calling this only on mouse movement doesn't seem to be the way it was intended. It may be a result of the other issues I'm having, but doing it by binding it to mouse movement causes a jerk effect: where it moves a little towards the target angle with each movement of the mouse. Is there some way to register it in order to have it called every frame or something?

Any help with these would be very much appretiated!
Matt
#3
03/09/2006 (4:52 pm)
Well, #1 sounds like it should just be player.getHeadRotation(), again, I'm not actually using this so I can't be sure - I've also got the feeling that this is being used in conjuction with the torso twist resource

http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6713

Goodness knows that what I'll be chosing to do - I'm trying to make a Resident Evil - style game with more RPG and sim elements, but its a learning excercise so i'm hopping subjects like a ferret on a sugar high.