miércoles, 30 de octubre de 2013


Arrays are done so that the first value is position 0, so, x - 0 and y - 1.

An example:
Scene.my.a = [1, 2, 3,]

Reading: scene.my.a(0) = 1
Reading: scene.my.a(1) = 2

For your specific example, it would be velocity(0)

The code would look something like this: scene.my.velX = velocity(0).

Unfortunately, you can only read an array element using an index. You cannot write to a single array element. For example, you CANNOT do velocity(0) = scene.my.velX. Many of us Thyme scripters have been begging for this fix for a long time, but it seems to fall on deaf ears. :x

And pos(0) and pos(1) are saying x position and y position.  

Re: Arrays

Postby Kilinich » Thu Nov 18, 2010 10:37 am
You can use something like this:

scene.my.bar = scene.my.bar * [0, 1, 1, 1] + [newValue, 0, 0, 0]

declare it as finction and it will makes you code shorter
Dream of Algodoo as game development engine...
User avatar
[Best bug reporter 2010]
Posts: 1502
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

No hay comentarios:

Publicar un comentario