Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/06/23 11:29
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
7 registered members (fairtrader, Quad, miwok, Martin_HH, AndrewAMD, alibaba, dpn), 581 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Simple collision unaffected by speed, and what's moving. #317508
04/01/10 00:32
04/01/10 00:32
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
I've been having quite some trouble with collision lately while working on my game.

I've run in to more problems once again. The player is now allowed to pick up boxes to obtain new weapons. To do this, I used an EVENT_IMPACT to check when the player collides with the box. One problem is that when the player jumps on the box (instead of running in to it), it doesn't trigger the function. Is there some way to simply make it that if these 2 collision boxes collide, no matter what else happens (doesn't matter what's moving, what's moving faster), that the function is triggered?

Another problem is that other things colliding with the box can make it trigger. I believe I've asked this before, and while I did get an answer, I don't think I figured out how to actually do what I was told to. I'm supposed to use skills to determine what's what. One skill is for the player, another for enemies, other skills for other categories. How would I tell the collision to only activate the function if an entity with skill## collides with it, and how do I actually set the skill for an entity? Is it like setting a FLAG?

Sorry for all the trouble. There's a lot about collision to learn, and it's getting a bit confusing. I didn't suspect that it would be so much trouble for such a simple game. tongue Perhaps, I'll be less messy when working on my next one.

Thanks in advance.

Last edited by Valdsator; 04/04/10 00:44.
Re: Simple collision unaffected by speed, and what's moving. [Re: Valdsator] #318657
04/09/10 01:20
04/09/10 01:20
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
Bump. grin

Re: Simple collision unaffected by speed, and what's moving. [Re: Valdsator] #318682
04/09/10 08:43
04/09/10 08:43
Joined: Nov 2008
Posts: 946
T
the_clown Offline
User
the_clown  Offline
User
T

Joined: Nov 2008
Posts: 946
First of all, a skill is set like, for example "my.skill1 = 2"... its nothing but a local var.
For your problem though I'd just use vec_dist, like this:

Code:
action itemPickup()
{
  ///set stuff u might need
  //// ...
  /// main loop
  while(1)
  {
    if(vec_dist(my.x,player.x) <= 10)  // play with the value
    break;  // exit loop
    ////////
    wait(1);
  }
  //// do what ever the item shall do when being collected here:

  ///....


}



Re: Simple collision unaffected by speed, and what's moving. [Re: the_clown] #318702
04/09/10 10:26
04/09/10 10:26
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
Yes, you can use skills for that. Example: give the Player my.skill22 = 1, and for the enemies my.skill22 = 2. now you can check in the event what colliding with the box, the you-Pointer point to the other entity.
If you have the event in the box action:
if(you.skill22 == 1)
...
if(you.skill22 == 2)
...

With your jumping code: i think you change the z from the Player directly, then the Impact is not triggered. Use for all movements c_move() instead of my.z


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