Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, ozgur, AbrahamR, wdlmaster), 849 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
RPG (Diablo) Movement #355407
01/26/11 19:53
01/26/11 19:53
Joined: Apr 2010
Posts: 23
G
GieskeBon Offline OP
Newbie
GieskeBon  Offline OP
Newbie
G

Joined: Apr 2010
Posts: 23
Hey Guys,

In AUM 34 there's a RPG movement and I'm trying to get it work again in A7. It have to work just like Diablo. Point with the mouse, click and the character walks towards the mouse click. But I'm getting some problems with it. i saw an older post but with no solution in it.

Here is my code:

Quote:

///////////////////////////////////////////////////////////

#include <acknex.h>
#include <default.c>

///////////////////////////////////////////////////////////

ENTITY* Speler;
ENTITY* Bestemming;
VECTOR temp;
VECTOR temp2;

function show_target()
{
while (mouse_left == 1) {wait (1);} // wait until the player releases the mouse button
while (mouse_left == 0) {wait (1);} // wait until the player presses the left mouse button again
ent_remove (me); // remove the old target
}

function speler_lopen()
{
c_trace(Speler,end, NULL);
c_move(Speler, vector(0.3,0,0), nullvector, GLIDE);
}


function set_target()
{
temp.x = mouse_pos.x;
temp.y = mouse_pos.y;
temp.z = 0;
vec_set(target,temp);
target.z = 10000;
vec_for_screen(temp,camera);
vec_for_screen(target,camera);
c_trace (temp,target,IGNORE_ME|IGNORE_PASSABLE|SCAN_TEXTURE);
bestemming = ent_create ("Destination.mdl", target, show_target);
}


action load_speler()
{

Speler = ent_create("barbarian.mdl", vector (temp.x,temp.y,temp.z), NULL);

while(1)
{
vec_set(temp, Speler.x);
vec_sub(temp, Speler.x);
vec_to_angle(Speler.pan, temp);

if (key_w) Speler.x += 6 * time_step;
if (key_s) Speler.x -= 6 * time_step;
if (key_a) Speler.y += 6 * time_step;
if (key_d) Speler.y -= 6 * time_step;

wait(1);


}

}


PANEL* info =
{
digits (30, 10, "X Destiny: %.0f", *, 1, temp2.x);
digits (30, 40, "Y Destiny: %.0f", *, 1, temp2.y);
digits (30, 70, "Z Destiny: %.0f", *, 1, temp2.z);
flags = SHOW;
}

function main()
{

video_mode = 9; // 1280x1024


level_load("small.hmp");
mouse_mode = 2;

load_speler();

while(1)
{

camera.x = Speler.x - 350;
camera.y = Speler.y;
camera.z = Speler.z + 200;
camera.tilt = -30;

if (mouse_left)
{
set_target();
}


Speler.tilt = 0;

wait(1);

}


}



This code isn't working any more. I tried something diffrent:

Quote:

function set_target()
{


vec_set(start,vector(mouse_cursor.x,mouse_cursor.y,10));
vec_for_screen(start,camera);
vec_set(end,vector(mouse_cursor.x,mouse_cursor.y,5000));
vec_for_screen(end,camera);

c_trace(start,end, NULL);

vec_to_angle(Speler.pan,end);

Bestemming = ent_create ("Destination.mdl", target, show_target);

speler_lopen();
}


This one working 50%. He sets a target and turn to it, but he turns always face up(face to the north). Like he only knows 180 degrees. When I press the '0' button for a free mode, you can chance the camera and then you could chance the 180 degrees angle.

I hope you understand my explanation and I hope you guys can help me with this problem.

Thanks

Dave

Re: RPG (Diablo) Movement [Re: GieskeBon] #355416
01/26/11 20:26
01/26/11 20:26
Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
Roel Offline
Senior Member
Roel  Offline
Senior Member

Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
about the set target:

at this moment you turn the entity as he would look from the nullvector postion, not from his own!

vec_set(temp,end);
vec_sub(temp,speler.x);
vec_to_angle(speler.pan,temp);

instead of the vector <end> I would use something like target.x,
but that's for later, I think laugh


Check out the throwing game here: The throwing game
Re: RPG (Diablo) Movement [Re: Roel] #355485
01/27/11 14:21
01/27/11 14:21
Joined: Apr 2010
Posts: 23
G
GieskeBon Offline OP
Newbie
GieskeBon  Offline OP
Newbie
G

Joined: Apr 2010
Posts: 23
hey Roel,

Thanks for your reply, but I still don't get it. The manual says the same thing.

Quote:

//get the direction from the entity ME to the entity YOU
vec_set(temp, you.x);
vec_sub(temp, me.x);
vec_to_angle(me.pan, temp);



Off topic:
He cool! Nog 1 Nederlander in flevoland!

Re: RPG (Diablo) Movement [Re: GieskeBon] #355552
01/27/11 21:12
01/27/11 21:12
Joined: Apr 2010
Posts: 23
G
GieskeBon Offline OP
Newbie
GieskeBon  Offline OP
Newbie
G

Joined: Apr 2010
Posts: 23
Bump


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