Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, SBGuy), 987 guests, and 3 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
collision with a rotating entity #435705
01/11/14 12:47
01/11/14 12:47
Joined: Dec 2009
Posts: 82
D
Denn15 Offline OP
Junior Member
Denn15  Offline OP
Junior Member
D

Joined: Dec 2009
Posts: 82
im trying to make an obstacle consisting of a rotating blade that will hurt you if you get hit by it, but i cant seem to get it to work. ive managed to make it work when the player is moving as well,but if the player stands still and the blade hits him, nothing happens.
how do i make something happen when the player stands stil and get hit?

Re: collision with a rotating entity [Re: Denn15] #435710
01/11/14 13:47
01/11/14 13:47
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
Use the EVENT_ENTITY. This should work.
Code:
void _event_hit(){
   if (event_type == EVENT_ENTITY){
      ...
   }
}
action ObstacleBlade(){
   my.emask = ENABLE_ENTITY;
   my.event = _event_hit;
   ...
}
action thePlayer(){
   my.emask = ENABLE_ENTITY;
   ...
}

Does it work with ENABLE_ENTITY ?

If not u could use
Code:
c_scan

or
Code:
vec_dist



cheers


Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: collision with a rotating entity [Re: Denn15] #435711
01/11/14 13:58
01/11/14 13:58
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
You will want to look into event_type / entity events. Than you have a few options; e.g. letting the blades detect the player through c_scan or c_trace. Best to use c_trace here cause it is more precise here I think.

See this tutorial for c_trace lite-c AUM tutorial.

First get two outer points of the blades where you want that if the player is between the 2 points, it is damaged (e.g. through vec_for_vertex). Than let the c_trace line begin on one end of the blades and let it end on the other side of the blades.

Something like this (I am in a hurry so could be that I missed something or made a mistake);

Code:
action blades ()
{
VECTOR vec_point_bladeleft;
VECTOR vec_point_bladeright;
....
while (1) {
vec_for_vertex(vec_point_bladeleft, my, 1); //check for the right vertex number the model in MED (the yellow dots)
vec_for_vertex(vec_point_bladeright, my, 2); //see above
c_trace (vec_point_bladeleft.x, vec_point_bladeright.x, SCAN_FLAG2); // trace between the blades on the right and on the left of the trap
if (you) {
if (you == player) you.HEALTH -= 2 * time_step;
} 
....
}
....
}



Ps; vec_dist is better if you don't need the trap/blades code to be very precise.



Last edited by Reconnoiter; 01/11/14 14:01.
Re: collision with a rotating entity [Re: Reconnoiter] #435714
01/11/14 17:35
01/11/14 17:35
Joined: Dec 2009
Posts: 82
D
Denn15 Offline OP
Junior Member
Denn15  Offline OP
Junior Member
D

Joined: Dec 2009
Posts: 82
ENABLE_ENTITY only works if both entities move also.

however by using c_trace as reconnoiter showed works like a charm. thanks for the help! laugh

Re: collision with a rotating entity [Re: Denn15] #435728
01/12/14 11:04
01/12/14 11:04
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Glad I could help laugh.


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