Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-16-2009, 05:02 AM
Ronnie Ronnie is offline
Registered User
Join Date: Jun 2008
Location: Nj, USA
Posts: 48
Ronnie is on a distinguished road
Send a message via AIM to Ronnie
Collision detection between gui controls.

Alright well, in a game i'm making I need to know if these 2 gui controls hit so, i tryed many methods i'm wondering why this one doesn't work, and or how I can make it work
PHP Code:
  // ron_dot & ron_plr are the gui control names
   
for(  0;  2;  .01 ) {
    
    if( 
ron_dot.ron_plr.) {
     
     for(  
0;  2;  .01 ){
     
      if( 
ron_plr.ron_dot.) {
    
       
player.chat "Hit";      

       }
      }
     }
    } 
then I also tried which semi works but not always.
PHP Code:
 //Using a bunch of cords and just checking if it matches?
  
this.xcords = { ron_dot.x,ron_dot..25ron_dot..5,ron_dot..75,ron_dot.x+1ron_dot.x1.5ron_dot.x+2,ron_dot..25,ron_dot..5,ron_dot..75,ron_dot.1ron_dot.1.5ron_dot.};
  
this.ycords = { ron_dot.y,ron_dot..25ron_dot..5,ron_dot..75,ron_dot.y+1ron_dot.y1.5ron_dot.y+2,ron_dot..25,ron_dot..5,ron_dot..75,ron_dot.1ron_dot.1.5ron_dot.};
  if ( 
ron_plr.x in this.xcords ) {
   if ( 
ron_plr.y in this.ycords ) {
    
player.chat "Hit";
   }
  } 
thanks in advance!.
Reply With Quote
  #2  
Old 07-16-2009, 05:15 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
You may not be using in, the way you meant to.

A good example of this..

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
setTimer(0.05);
}

function 
onTimeout() {
  if (
player.x in |20,40| && player.y in |20,40|) {
    
player.chat "You are in the zone!";
  }
  
setTimer(0.05);

__________________
Quote:
Reply With Quote
  #3  
Old 07-16-2009, 05:25 AM
Ronnie Ronnie is offline
Registered User
Join Date: Jun 2008
Location: Nj, USA
Posts: 48
Ronnie is on a distinguished road
Send a message via AIM to Ronnie
Alright wow I was almost using that completely wrong, thanks for the heads up again!
Reply With Quote
  #4  
Old 07-16-2009, 06:02 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by Ronnie View Post
Alright wow I was almost using that completely wrong, thanks for the heads up again!
For your purpose yes. That's why I typically use it the way you originally did it for scenarios like this:

PHP Code:
temp.value "apples";
temp.array = {"oranges""apples""bananas"};
if (
temp.value in temp.array) echo("apples!"); 
Anyway glad I could be of help.
__________________
Quote:
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:24 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.