Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,382 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 4 1 2 3 4
Re: 144655 entities instead of 5 entities... [Re: JokeSpeaker] #185583
02/28/08 14:03
02/28/08 14:03
Joined: Mar 2007
Posts: 151
JokeSpeaker Offline OP
Member
JokeSpeaker  Offline OP
Member

Joined: Mar 2007
Posts: 151
So I have now two problems.

1. At the (event_type == event_entity) the you is always null, too by collisions with entities. Which premises are for you that it will set right?

2. If the enemy looks with
vec_set(temp,you_pos);
vec_sub(temp,my.x);
vec_to_angle(my.pan,temp);
to another entity, it will done suddenly and not soft. How can I make it, that it rotate slower to the another entity?

Re: 144655 entities instead of 5 entities... [Re: JokeSpeaker] #185584
02/28/08 16:42
02/28/08 16:42
Joined: Aug 2005
Posts: 312
Sweden
tindust Offline
Senior Member
tindust  Offline
Senior Member

Joined: Aug 2005
Posts: 312
Sweden
For 1. I think you need to use event_impact,
For 2. You can do it several ways. If you want to make it look real and "organic" you need to use physics entities and apply rotational force so that the entity turns in a realistic way. Another way, which is a bit more "robotic" is to use a while-loop to change the rotation in small steps until the desired direction is reached.

Re: 144655 entities instead of 5 entities... [Re: tindust] #185585
02/28/08 18:03
02/28/08 18:03
Joined: Mar 2007
Posts: 151
JokeSpeaker Offline OP
Member
JokeSpeaker  Offline OP
Member

Joined: Mar 2007
Posts: 151
1. I tested it yet with impact, but I will try it again.
EDIT: It didn't run, too. ><

2. Physics can't I use, for that my version is too low. And the other I tried, but it didn't run right. I will try it again, too. But it is nice, if someone can post me his idea.

Last edited by JokeSpeaker; 02/28/08 18:27.
Re: 144655 entities instead of 5 entities... [Re: JokeSpeaker] #185586
02/28/08 23:13
02/28/08 23:13
Joined: Aug 2005
Posts: 312
Sweden
tindust Offline
Senior Member
tindust  Offline
Senior Member

Joined: Aug 2005
Posts: 312
Sweden
Here is a suggested (untested) code to try. You may have to play with the numbers a bit, but it should get you started.
Code:

function turn_toward_target
{
var original_direction[3];
var new_direction[3];
var pan_difference;
var pan_direction;

vec_set(original_direction,my.pan);
vec_set(temp,your.pos);
vec_sub(temp,my.pos);
vec_to_angle(new_direction,temp);

pan_difference = (360-new_direction.x) - (360-original_direction.x);
if((pan_difference > 0) && (abs(pan_difference) < 180))
{
pan_direction = 1;
}
else
{
pan_direction = -1;
}

while(my.pan != new_direction.x)
{
my.pan += pan_direction; // adjust angle increment by multiplying with 0.1 .. 10
wait(-time_step); // adjust turn speed by multiplying with 0.01 .. 100
wait(1);
}
}



Re: 144655 entities instead of 5 entities... [Re: tindust] #185587
02/29/08 12:25
02/29/08 12:25
Joined: Mar 2007
Posts: 151
JokeSpeaker Offline OP
Member
JokeSpeaker  Offline OP
Member

Joined: Mar 2007
Posts: 151
Thx, but it isn't run right. The entities shivered very quick and fly 90° to many. And in my version, time_step does'nt exist.

Re: 144655 entities instead of 5 entities... [Re: JokeSpeaker] #185588
02/29/08 16:42
02/29/08 16:42
Joined: Aug 2005
Posts: 312
Sweden
tindust Offline
Senior Member
tindust  Offline
Senior Member

Joined: Aug 2005
Posts: 312
Sweden
Well, it was just a suggestion to get you started on the code . You will have to adapt it to your version and make it work for your purpose .
cheers,

Re: 144655 entities instead of 5 entities... [Re: tindust] #185589
02/29/08 17:43
02/29/08 17:43
Joined: Mar 2007
Posts: 151
JokeSpeaker Offline OP
Member
JokeSpeaker  Offline OP
Member

Joined: Mar 2007
Posts: 151
ok, I will work at your script ^^

EDIT: I'm too stupid for this math. All my experiments failured.

Last edited by JokeSpeaker; 02/29/08 18:47.
Re: 144655 entities instead of 5 entities... [Re: JokeSpeaker] #185590
03/01/08 07:57
03/01/08 07:57
Joined: Aug 2005
Posts: 312
Sweden
tindust Offline
Senior Member
tindust  Offline
Senior Member

Joined: Aug 2005
Posts: 312
Sweden
Here are two small adjustments to the code:
1/ use time instead of time_step (which version of Game Studio do you use?)
2/ Change the line

if((pan_difference > 0) && (abs(pan_difference) < 180))
to
if((pan_difference > 1) && (abs(pan_difference) < 180))

Re: 144655 entities instead of 5 entities... [Re: tindust] #185591
03/01/08 08:07
03/01/08 08:07
Joined: Mar 2007
Posts: 151
JokeSpeaker Offline OP
Member
JokeSpeaker  Offline OP
Member

Joined: Mar 2007
Posts: 151
1. Time_step I yet writed in time.

2. Ok, I will test it.
EDIT: Now the entities fly always in a circle, how they have only pan += X;

I use A6 Extra.

Last edited by JokeSpeaker; 03/01/08 09:04.
Re: 144655 entities instead of 5 entities... [Re: JokeSpeaker] #185592
03/02/08 13:23
03/02/08 13:23
Joined: Mar 2007
Posts: 151
JokeSpeaker Offline OP
Member
JokeSpeaker  Offline OP
Member

Joined: Mar 2007
Posts: 151
sry for doubleposting, but I have a new question.

Run you by events only in event-functions or by if(event_type...) in the action, too?

And the "looking slower to another entity" still didn't run, although I tried many experiments...

Page 3 of 4 1 2 3 4

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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