Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,449 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Collision #367652
04/16/11 07:12
04/16/11 07:12
Joined: Apr 2011
Posts: 40
germany
W
Wollez Offline OP
Newbie
Wollez  Offline OP
Newbie
W

Joined: Apr 2011
Posts: 40
germany
Hi,
I've finally managed to create a code for collision, so now the model knows when its hit by sth. But then it still doesn't know with what it has collided. like it can't know if it hits a bullet or another player
I've read that you must do sth with a "you" pointer, but I dont get it.
here the code:

function collision_event()
{
if (event_type == EVENT_ENTITY || event_type == EVENT_IMPACT) // the entity has collided with one of the entities in the level?
{
hit = 1;
}
}

action something()
{
my.emask |= (ENABLE_BLOCK | ENABLE_ENTITY | ENABLE_IMPACT;
// make entity sensitive for block and entity collision
my.event = collision_event;
}
hope someone can help me

Re: Collision [Re: Wollez] #367676
04/16/11 13:20
04/16/11 13:20
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Please use the [code ] tag in future posts.
Define a skill that tells you what type of entity it is:

Code:
#define _type skill100
#define type_player 1
#define type_enemy 2
#define type_bullet 3



Now, in your player, enemy and bullet action, you set _type to the appropriate value:

Code:
function bullet() {
my._type = type_bullet;
...
}



Finally, you are able to identify the type of object in your collision_event:

Code:
if(your._type == type_bullet) { ... }




"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Collision [Re: Superku] #367740
04/17/11 13:08
04/17/11 13:08
Joined: Apr 2011
Posts: 40
germany
W
Wollez Offline OP
Newbie
Wollez  Offline OP
Newbie
W

Joined: Apr 2011
Posts: 40
germany
Thanks a lot Superku!!
ääähhhh, I'm sorry to ask such a primitive question, but how do I do code Tags? blush

Re: Collision [Re: Wollez] #367744
04/17/11 13:34
04/17/11 13:34
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
[code ]post your code here[/code ]
(Remove the spaces.)


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends

Gamestudio download | 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