The Daily Click ::. Forums ::. Klik Coding Help ::. Fastloop trouble
 

Post Reply  Post Oekaki 
 

Posted By Message

Robbert



Registered
  19/06/2003
Points
  420
24th January, 2006 at 18:43:37 -

Hi all,

I am doing a tycoon game in the perspective of Rollercoaster Tycoon (isometric that is).
Right now I am working on the engine of turning isometric coords (x, y and z) into standard screen x and y values.

So far this works. Even in 4 directions (so you can witch your view with 90 degrees just like in RCT).
The objects that are created on the playfield are defined in an external INI file like this:

------------
[glide]
no=5
obj0=2,0,2
obj1=1,3,0
obj2=3,4,0
obj3=6,7,0
obj4=8,8,-3
------------

which means objN=x,y,z

A fastloop is being used to create those INI-lines into real objects on the playfield. The objects all get Alt Values. Value X = INI-x, value Y = INI-y and value Z = INI-z and Value N = loopindex

This is for not having to do loops over and over again to get some info about the objects.

So far no problems. But now I want to create a mode that shows the z-values of the objects on the playfield to the player. This way you can see how high your glide is. This is useful when you're building or modifying your glide (yeah it is a swimming pool/camping tycoon game).

This loop I've created:

Button clicked:
create loop "show-z" N0bjects times

On loop shoz-z +
Loopindex(show-z) = Alterable Value N("object"):
Create string object at 0,0 from object &
Set alterable string of string object to Str$(Alterable Value Z("object"))

The last line is where it goes wrong. This one is only working on the last object of the glide. All the other string objects remain with the default text in it.

Can anyone help me with this? It'd be great

 
Hey mates, I'm Iglo yeah =P!

Robbert



Registered
  19/06/2003
Points
  420
24th January, 2006 at 23:12:11 -

Never mind. I already got it.

This was the old code:

Button clicked:
create loop "show-z" N0bjects times

On loop shoz-z +
Loopindex(show-z) = Alterable Value N("object"):
Create string object at 0,0 from object &
Set alterable string of string object to Str$(Alterable Value Z("object"))

I replaced "" Loopindex(show-z) = Alterable Value N("object") "" with
Pick objects with Alterable Value N = loopindex(show-z) and that seems to work. I'm really happy with it.

Now maybe you guys can answer this:
What is the smallest to calculate for the memory of the computer? A counter, a string object of a text object?
I need many of these objects, so it's best to take small amount of computer power.

 
Hey mates, I'm Iglo yeah =P!
   

Post Reply



 



Advertisement

Worth A Click