View Single Post
  #7  
Old 03-12-2008, 11:46 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Yes and like I said, use a TStaticVar object and define its functions with function objects or a class.
PHP Code:
//// Example Script
function onCreated() {
  
this.topleft = Objects.Rect(null, 0, 0, screenwidth / 2, screenheight / 2);
}
function 
GraalControl.onMouseDown() {
  if (
this.topleft.inside(mousescreenx, mousescreeny)) {
    
// do stuff
  
}
}
//// Weapon Script: Objects
public function Rect(objname, nx, ny, nw, nh) {
  
temp.obj = new TStaticVar(""@objname);
  
obj.x = int(nx);
  
obj.y = int(ny);
  
obj.w = int(nw);
  
obj.h = int(nh);
  
obj.join("type_rect");
  return 
obj;
}
//// Class Script: type_rect
function inside(nx, ny) {
  if (
nx in |this.x, this.x + this.w| && ny in |this.y, this.y + this.h|) {
    return 
true;
  }
  return 
false;
}
public function 
objecttype() {
  return 
"TRect";
} 
It is not necessary to include what you're saying into GScript when the same functionality can already be achieved.
__________________

Last edited by Inverness; 03-13-2008 at 12:00 AM..
Reply With Quote