Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #15  
Old 11-04-2011, 04:11 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're looping through each player and only using the element 1 in the array. I believe there was an error in my code unfortunately I can't go back and edit it now.

In your drawing function record the following in an array:

this.drawing.add({temp.p, 200 + temp.i});

In your updating function loop through your drawing array:

PHP Code:
for (temp.drawthis.drawing) {
  
temp.plyr temp.draw[0];
  
temp.img_index temp.draw[1];
  
with (findimg(temp.img_index)) {
    
// Update position
    
temp.plyr.x;
    
temp.plyr.y;
  }
  
with (findimg(temp.img_index 1)) {
    
// Update position
  
}

Also just some small optimizations/changes you can make as well:

1. Store the width and height of your bar graphics in a variable outside the loop. Calling getimgwidth and getimgheight repeatedly isn't needed.
2. Use partx, party, partw, and parth instead of changeimgpart since you're already using findimg in a with statement.

PHP Code:
// Using part in findimg assignments
with (findimg(200)) {
  
image "head0.png";
  
partx 0;
  
party = (32 2);
  
partw 32;
  
parth 32;
}
// Same thing as doing:
changeimgpart(200032 23232); 
3. Be more consistent when using temp. In the same line you use it with and without the prefix. Avoid setting global variables (your line part=math+blah that don't need to be global. You can do that by putting temp. I.e: temp.part.
__________________
Quote:
Reply With Quote
 


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 06:18 AM.


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