Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (ozgur, TipmyPip, AndrewAMD), 1,209 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to aim in 3rd person shooter #246205
01/14/09 06:16
01/14/09 06:16
Joined: Dec 2008
Posts: 93
YOU AINT GONNA NEED THAT!
M
MAGA Offline OP
Junior Member
MAGA  Offline OP
Junior Member
M

Joined: Dec 2008
Posts: 93
YOU AINT GONNA NEED THAT!
In my project there are few non-moving camera, they allways looks at player, I need to make a code to aim, like in Resident Evil if i press key_* then player model mast play animation "aim", turn to closer enemy and around the enemy mast apear curcle. How can I do that? Please give me an example.

Re: How to aim in 3rd person shooter [Re: MAGA] #246218
01/14/09 08:40
01/14/09 08:40
Joined: Nov 2008
Posts: 946
T
the_clown Offline
User
the_clown  Offline
User
T

Joined: Nov 2008
Posts: 946
I'm at school at the moment so I can't give you exact code, but I did something like that before;
First, for the turning, you'll have to check if there's an enemy nearby; I'd use c_scan for that, it returns the you-pointer you need. Then you'll have to turn the player, what should be easy; take a look at vec_to_angle in the manual. Last thing to do are the animation and the circle.
If you don't want the player to be able to walk while aiming, you simply can blend into the "aim" animation (ent_blend).
The circle should be a panel, take a look at vec_for_screen in the manual.
I'll try to give you an example right when I'm back home.

Re: How to aim in 3rd person shooter [Re: the_clown] #246220
01/14/09 09:07
01/14/09 09:07
Joined: Dec 2008
Posts: 93
YOU AINT GONNA NEED THAT!
M
MAGA Offline OP
Junior Member
MAGA  Offline OP
Junior Member
M

Joined: Dec 2008
Posts: 93
YOU AINT GONNA NEED THAT!
Thank you dude smile I'll try, and I waiting for example smile

Re: How to aim in 3rd person shooter [Re: MAGA] #246319
01/14/09 16:39
01/14/09 16:39
Joined: Dec 2008
Posts: 93
YOU AINT GONNA NEED THAT!
M
MAGA Offline OP
Junior Member
MAGA  Offline OP
Junior Member
M

Joined: Dec 2008
Posts: 93
YOU AINT GONNA NEED THAT!
Still waiting smile

Re: How to aim in 3rd person shooter [Re: MAGA] #247928
01/23/09 13:25
01/23/09 13:25
Joined: Nov 2008
Posts: 946
T
the_clown Offline
User
the_clown  Offline
User
T

Joined: Nov 2008
Posts: 946
Excuse me for this, I just have forgotten this....
I am so ashamed.
However, let's see.
You want the model to play the "aim" animation, turn to the next enemy and you want the enemy to be selected by a circle, right.

I don't know how your code looks like, but I suppose you have a loop running in the player action.
Now, in this loop, you have to check if the player is pressing a certain key. Then you have to check for the enemies, turn the player to the nearest one and play the animation:

first, define a entity:

ENTITY* selected_enemy;

////////////////////////////////////////////////////////////////////
if(mouse_right)
{
c_scan(my.x,my.pan,vector(360,360,3000),IGNORE_PASSABLE);
if(you)
{
if(you.skill6 == 1) // the enemy should have set skill6 to 1
{
selected_enemy = you;
vec_set(temp,your.x);
vec_sub(temp,my.x);
vec_to_angle(my.pan,temp); // now MY looks at YOU
my.tilt = 0;
vec_set(my.move_x,vector(0,0,0));
//replace move_x with the skill you are using for moving

my.skill3 += 20*time_step; // blend factor for 1-frame animation
my.skill3 = min(my.skill3,100); // clip at 100 percent
}
}
}
else
{
my.skill3 -= 20*time_step;
my.skill3 = max(my.skill3,0); // clip at 0 percent
}

ent_blend("aim",0,my.skill3);
/////////////////////////////////////////////////////////////////////////////

you should put this whole code snippet (exept for the entity definition) at the end of your player loop (but before the wait(1) of course).

for the circle just define a panel with the circle bitmap and write a function that permanently sets the world coordinates of the selected_enemy entity to 2d coordinates. (vec_to_screen).
I'm sorry if this doesn't work right, just post then. I've put this together in ten minutes using the online manual and my memories; I don't have access to my own code now.


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1