newt's Forum Posts

  • Can't the array object be used just like that?

    Set the size to say (100, 2) for one hundred pairs of numbers.

    (n, 0) would be the x's and

    (n, 1) would be the y's.

    Ex:

    -+For each sprite

    ->Sprite set x to ArrayAt(loopindex, 0)

    ->Sprite set y to ArrayAt(loopindex, 1)

    And if you later want an angle to be included set the array size to (100, 3) and (n, 2) would be the angles.

    Yeah, that would work.

    What would be nice though, is to add the functionality like a stack, where you can push, or pop values to certain places, like.

    -+ sprite set x to 1darray getTop.x

    -+ sprite set y to 1darray getTop.y

    -> 1darray popTop

    You can do that with Array, but for ease of use, the stack method would be pretty sweet.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Wastrel

    The second, with exception that C2 doesn't handle arrays in expressions, so you wouldn't want to get both values at once, unless you were doing something like setting text.

    Ashley

    Im not familiar with that formula, so I cant say for sure.

    What it does offer is an order, say for example a path.

    -+ for n = 0 to 1dimensionalarray.length

    ->sprite set x to lerp(sprite.x,1dimensionalarray(loopindex("n")).x,something*dt)

    ->sprite set y to lerp(sprite.y,1dimensionalarray(loopindex("n")).y,something*dt)

    Course you would use some kind of timer with that as well, but you get the idea.

    -+every n seconds set global.value("tcount")to clamp(global.value("tcount")+1,0,1dimensionalarray.length)

    ->sprite set x to lerp(sprite.x,1dimensionalarray(global.value("tcount")).x,something*dt)

    ->sprite set y to lerp(sprite.y,1dimensionalarray(global.value("tcount")).y,something*dt)

    Or just something to sort things to predetermined positions:

    -+For each sprite

    ->Sprite set x to 1dimensionalarray(loopindex).x

    ->Sprite set y to 1dimensionalarray(loopindex).y

    To do stuff like that using the regular array is not real straight forward, as you would have to do a Boolean comparison, like is value at array(x,y)= 1, do stuff.

    Problem is when doing it that way, its not easy to get the order straight.

  • OK, yeah it sounds silly, but my idea, or twist is a vector, or a x,y value for each index in the array, rather than the opposite a single value at an x, and y position like in the regular array object.

    Something like getx, or gety at index in onedimensionalarray.

    Much better way to keep track of a bunch of positions imho.

    Of course you would also want set x,y, as well as set, and get length of index, etc.

    Anyway its kinda like the datastructures plugins of both Cc, and C2, just with the ability at have two values.

    Any thoughts, and or takers?<img src="smileys/smiley4.gif" border="0" align="middle" />

  • yes download this clickteam.com/website/usa/patch-maker.html its really easy i use it also check out there other products

    Wut?

  • Hi

    Might add an image point to spawn the bullet from when the sprite is mirrored.

  • Does the Canvas allow me to draw a curved line, if for example i left mouse click and move the cursor away to another position and release the mouse?

    Yeah, you would have to set up a counter, and some variables for each click, like on click one set start xy to mouse xy, on click two set end xy to mouse xy, then on click 3 set offset to mouse xy.

    Then on mouse release draw using the variables.

    Or you could set up your own spline with handles, but that's way more complicated.

  • Well it would be useful to keep track of what's where. As it is now you have to track that from memory as you add instances. So if you have a lot of instances that would be helpful.

    And its not quite as bad as uid, as you would at least know what to expect to happen when you delete something.

    Unless it's not possible to auto-delete any conditions pointed at that index. Then of course its not practical.

  • No, but that's a nice idea.

  • newt - I don't understand, you're supposed to use a variable with a UID. What's wrong with that?

    Instance indices are useless because they change all the time. If you delete the object with index 0 every single other instance changes its index. So if you stored an index in a variable it's now wrong. Why would you ever want to use that?

    Well that's my point, you wouldn't, but its easier to pick.

    As it is you have to make an additional action to use uid, but that's only if the object is already picked, and the only realistic way is on creation.

    Anyway I'm just saying uid's are pointless, as we have the index, or variables.

    And yes picking using the index really doesn't work for everything, unless you were to make it possible to change the index like you would a z index.

    .... I think.

  • I do have to add UIDs were added specifically for remembering object instances in combination with the 'pick by UID' condition - I would say they are best suited for that, instance indexes won't really cut it since they change and UIDs never change.

    Yeah, but picking by uid is useless with out using a variable, and you can skip the uid part, then just use a variable.

    Plus you can set the variable in the editor.

    Seriously you would be better off setting a variable to the sprite index, rather than its uid.

    Yes I know you can't do that. <img src="smileys/smiley17.gif" border="0" align="middle" />

  • The index is based on how many instances exist, or how many are picked, so yes that number will change if you create or destroy instances.

    Like if you destroy sprite(0), sprite(1), will then be able to be referenced as the old sprite(0).

    If you need a something to constantly pick a specific instance, you should use an instance variable.

    That's essentially the same method as using the uid by setting a sprites instance variable to its uid on creation, but when you think about it, that's an extra step that's not needed, as you can pick via instance variable just as easy as you can pick by uid.

    Also I think one way to think about uid's is to treat them as if they were random numbers.

  • 1. Not sure how a debugger would work since even the preview runs off of another program... your browser.

    However the text object can be used with events fairly efficiently.

    2. Please, please, please stop using uid. It was not designed for this purpose.

    Instead use the object index, as in sprite(index). Each time you add an instance(even in the editor) it is assigned an index based on how many instances already exist. That's far more practical than trying to guess what the uid is.

    Just remember that sprite(0), or tiledbg(0) is the first instance added, sprite(1) is the second etc.

  • You just have to dig around in the conditions. As it is there are several different ways to pick an instance.

    First off when an object is created, either by the system, or spawned by another object, it is automatically placed into the selected object list, or picked if you prefer.

    You can also pick via other methods such as on collision, x,y, opacity, etc.

    Then there are other more specific methods such as the instances variable, its uid, or "pick nth", an index of the instances of that existing object.

    Keep in mind the the selected object list is kept for the top tier event, and sub-events directly connected under it.

    Second tier sub-events may loose picking depending on how you reference the initially picked object.

    For practice, I would suggest assigning some Boolean values to the instances variable when it is created.

    -+On mouse left clicked

    -> system create sprite

    -->sprite set instance variable sprite.("on") to 1

    -+On mouse right clicked

    -> system create sprite

    -->sprite set instance variable sprite.("on") to 2

    You can then do a comparison for the instance variable. If the value = 1 do this, 2 do something else.

  • If webgl is to be an option, as it may have to be with the power of two textures being an issue, I would say no to removing xor.

  • For that you could use x+1, x-1, y+1, y-1, or sin, and cos.

    Then there's the datastructures plug('s) to store things.