Message Board


Message Board > Fenix / Bennu / Gemix / DIV > Sizing different objects from same process

December 26, 2006, 23:43
Atari
old guy
18 posts

Anyone have any pointers for sizing objects created from the same process? In other words, I'm spawning different objects from the same process, then using size to scale them up.

Code:
process blah(x,y);  //x and y are generated randomly
private
scale_timer;
begin
graph=2;
size=1;
scale_timer=10;
repeat
scale_timer--;
  if (scale_timer<=0)
    size+=1;
    scale_timer=10;
  end
  frame;
until (size==100)
end
//more code here

'
What this does in effect is create new objects when I call it, but in the same size as the first object. What I'd like to do is have every object created to have different size attributes. For instance, the first object is created, sizes up to about 15, then a new one is created at size 1, rather than being at size 15 once it's created. Make sense?

I assume bigbro and smallbro would be used in this case, but I haven't figured out quite how to use them. I've searched around a bit for info on these two functions, but haven't found anything matching my query. Any suggestions?

Thanks in advance for any help offered.

[Edited on December 26, 2006 by Rincewind]
____________
#
December 27, 2006, 03:17
Sandman
F3n!x0r
1194 posts

Can't you give the blah() function an extra parameter max_size and use it instead of 100 in the repeat-until loop?

Or are you suggesting all objects of the same processtype share the same size variable?

Bigbro is a local variable, which contains the ID of the process created by the same father as the local father (meaning bigbro.father==father) *before* the local process was created. The 'local process' is the process containing the bigbro variable.
Smallbro is the same, except it's about a process created *after* the local process.
Suppose you have a process called Parents(). Parents() calls three other processes in order: John(), Steven(), Seagal().
John()'s bigbro is 0.
John()'s smallbro is Steven().
Steven()'s bigbro is John().
Steven()'s smallbro is Seagal().
Seagal()'s bigbro is Steven().
Seagal()'s smallbro is 0.
So:
John.smallbro == Steven
Seagal.bigbro.bigbro == John
Steven.bigbro.smallbro == Steven
John.mother == yomomma
It's very much like real brothers, etc.
____________
BennuWiki
Yes, my avatar has grey borders in IE (so get a decent browser)
ROOFLEZ ROOFLEZ
#
December 27, 2006, 11:39
Atari
old guy
18 posts

Quoting Sandman:
Can't you give the blah() function an extra parameter max_size and use it instead of 100 in the repeat-until loop?

Or are you suggesting all objects of the same processtype share the same size variable?

That's what I assumed. I'm still stuck a bit in my BASIC days :) So, if I were to add a parameter for maximum size to the process (i.e. blah(x,y,max_size)) and change my loop, I could accomplish different scaling sizes for separate objects (thanks for rewriting my explanation Rincewind)?

Quoting Sandman:
Bigbro is a local variable, which contains the ID of the process created by the same father as the local father (meaning bigbro.father==father) *before* the local process was created. The 'local process' is the process containing the bigbro variable.
Smallbro is the same, except it's about a process created *after* the local process.
Suppose you have a process called Parents(). Parents() calls three other processes in order: John(), Steven(), Seagal().
John()'s bigbro is 0.
John()'s smallbro is Steven().
Steven()'s bigbro is John().
Steven()'s smallbro is Seagal().
Seagal()'s bigbro is Steven().
Seagal()'s smallbro is 0.
So:
John.smallbro == Steven
Seagal.bigbro.bigbro == John
Steven.bigbro.smallbro == Steven
John.mother == yomomma
It's very much like real brothers, etc.


I think I get it. Guess it wouldn't help in this case. I figured it had to do with inheritance of objects rather than processes. But I guess you could use it in that manner, now that I look at it. I'll have to study it more to get my head around it better.

Thanks for the help.
____________
#
December 27, 2006, 13:45
Sandman
F3n!x0r
1194 posts

Objects of the same type do not share the same size variable. Though when you do things like <<my_processname.size = 100;>>, all objects of type my_processname will get size 100.
You can adjust them individually by doing <<get_id(my_processname);>> in a frameless loop. get_id() will return a different objectID each time, until it returns 0 (then it has returned all objects). You can reset it with a framestatement, even <<frame(0);>>.
Or when calling the blah()'s, put all the ID's in an array. This way you can access them individuallly too, but also have the proper order of creation.
____________
BennuWiki
Yes, my avatar has grey borders in IE (so get a decent browser)
ROOFLEZ ROOFLEZ
#
December 27, 2006, 16:44
Rincewind
programmer
1545 posts

@Atari: Only fixed your code tags, it does something strange in internet explorer.
____________
Personal website: http://www.loijson.com
#
December 28, 2006, 01:54
Atari
old guy
18 posts

Quoting Rincewind:
@Atari: Only fixed your code tags, it does something strange in internet explorer.


Ahh... well, it was about 5:30am and I had been coding for the better part of 10 hours at the time, so my recollection of that post is a bit fuzzy :)
____________
#
December 28, 2006, 16:26
Atari
old guy
18 posts

Quoting Sandman:
Objects of the same type do not share the same size variable. Though when you do things like <<my_processname.size = 100;>>, all objects of type my_processname will get size 100.
You can adjust them individually by doing <<get_id(my_processname);>> in a frameless loop. get_id() will return a different objectID each time, until it returns 0 (then it has returned all objects). You can reset it with a framestatement, even <<frame(0);>>.
Or when calling the blah()'s, put all the ID's in an array. This way you can access them individuallly too, but also have the proper order of creation.


I've started playing around with this a bit. I'll have to sit down and really think it through to make use of it. I've added this process:

Code:
process ship_id();
begin
shipid[curshp]=get_id(type spawn1);
curshp++;
if (curshp>99)
  curshp=0;
end
end


and call it from spawn1(x). In that process, I'm able to check for the existance of the id, and manipulate the size of shipid[curshp]. But it's a bit unpredictable at the moment. I'll have to play around a bit more to really get my head around it.

Thanks for the help.
____________
#
December 28, 2006, 18:37
Sandman
F3n!x0r
1194 posts

Don't forget the funtion exists(<processid>|<processtype>). Returns true (1) if the specified id exists, otherwise false (0).
____________
BennuWiki
Yes, my avatar has grey borders in IE (so get a decent browser)
ROOFLEZ ROOFLEZ
#
December 31, 2006, 14:55
Quiest
now with more happynes
142 posts

I really love your bro-explanation, Sandman :D

[Edited on December 31, 2006 by Quiest]
____________
Roundhousekick to the face, baby!
#
December 31, 2006, 17:15
Sandman
F3n!x0r
1194 posts

Why thank you, it took much blood and tears in the creation of poetry of this magnitude. ;)
____________
BennuWiki
Yes, my avatar has grey borders in IE (so get a decent browser)
ROOFLEZ ROOFLEZ
#

Message Board > Fenix / Bennu / Gemix / DIV > Sizing different objects from same process

Quick reply


You must log in or register to post.
Copyright © 2005 Booleansoup.com
Questions? Comments? Bug reports? Contact us!