Thread: testimage(x,y)
View Single Post
  #1  
Old 12-05-2001, 10:22 PM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
testimage(x,y)

just like testnpc but for showimg.

You would prabably have to implement things like.

image[index].x
image[index].y
image[index].width
image[index].height
image[index].type
showimg index,image,x,y;
imgtype index,5;

Now you can check for the image with the specified type.

Like if you have a bunch of images in a level and only want to detect certain one's you can change the type and check for that.

etc... surely there are more things....


There could be many use's for this im sure. And several I can think of right now.


NPC Code:

if (playerenters){
for (this.i=0;this.i<10;this.i++){
xys[this.i+0]=random(0,64);
xys[this.i+1]=random(0,64);
xys[this.i+2]=random(-1,1);
xys[this.i+3]=random(-1,1);
showimg this.i,stone.gif,xys[this.i],xys[this.i+1];
imgtype this.i,5;
}
timeout=.05;
}

if (timeout){
for (this.i=0;this.i<arraylen(xys);this.i+=4){
xys[this.i+0]+=xys[this.i+2];
xys[this.i+1]+=xys[this.i+3];
showimg this.i,stone.gif,xys[this.i+0],xys[this.i+1];
}
timeout=.05;
}

// insert into npc trying to test for these randomly flying rocks
// with a type of 5

function test(){
for (this.i=0;this.i<imagescount;this.i++){
if (images[this.i].type==5){
if (testimage(x,y)==this.i){
putexplosion2 3,0,x,y;
}
}
}
}




... I hope that conveys the idea...
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote