Page 1 of 1

nearest instance,. .

Posted: Sun Dec 07, 2008 7:22 am
by jph_wacheski
OK I thought I could get this to work but WOW strangeness happening,. .

see file,.

not really sure what is happening here,. with the array dimed to [9,0] sic! I get the target_indicator on the last target to spawn,. nor sure how,. and with it set the way it should be [9,2] nothing,. what? Can anyone please point out;
A. why i get that result with the array [9,0] and
B. how to do this so it actualy works?

Either I am missing something very basic (if i only had a,...),. or something is not working how I understand it should.

Posted: Sun Dec 07, 2008 11:38 am
by Kjell
Hi jph,

Each dimension of a Array needs a length of at least 1 for it to be able to hold any data at all ... otherwise ZGE ( should ) returns a "Array out of Bounds" error as soon as you try to read/write to it.

And I'm not quite sure why your example doesn't work, but I've attached a example of what you're trying to do. Keep in mind that you'll need a register as soon as you're going to delete Instances.

K

nice one,. .

Posted: Sun Dec 07, 2008 2:33 pm
by jph_wacheski
Cool, thanks kjell!
Thought I was trying to do something imposible for a second there,. just gald to see it working! I will go through and reconcile your method with my working style and see if I can get it to work while destroying them,. what do you mean by a "register",. just some way of knowing not to check dead ones? idealy it will be an automated system that can check a dynamic number of instances as they are birthed and destroyed,. . I'll see if I can hack that out,. thanks again bro.

Posted: Sun Dec 07, 2008 3:09 pm
by Kjell
Hi jph,

Well, something that for instance emulates the ds_list of GM. Since when you for example spawn 8 instances, and then destroy instance 5, you're left with a open slot. Now there are a couple of approaches you can take here ( re-assigning identities, keeping track of used / un-used slots ) .. but I usually go with a Registry array that keeps track of the active instances and refers to the according slot where it's Data is stored.

K

Posted: Sun Dec 07, 2008 4:03 pm
by jph_wacheski
humm that sounds like another good idea,. I will see if I can integrate it.
I just implemented it as 'waves' for now as I just want to build a quick and dirty game for some fun,. here is the very basic start.

ARROWS and Z,X or C (hay,. can we assign Shift and Control?? for my german freinds ;) and other with non-engrish boards )

Could be lockOn2 the successor to my very first GM release,. could do some crazzy stuff now in ZGE so it will be a fun one,. Cheers.