tulamide's Forum Posts

  • ...what does it buy me over just using a 3D array such that one index is the Object.UID, the second dimension is the variable name, and the third is the value?

    That's not the way, arrays work. An array is just a line of cells, and you access those cells by using coordinates. Whatever count of coordinates you have, it leads to exactly one cell.

    <img src="http://www.kevblog.co.uk/blog/97/as3_2D_3D_arrays.gif" border="0">

    <img src="http://www.codeproject.com/KB/cs/Arrays-dontumindit/array9.gif" border="0">

    So, to access the data you need to do something like this: var = array(2, 1, 4)

    To store a value it is: array(2, 1, 4) = "one cell"

    (Just pseudo code in the following text)

    The basic idea of object oriented programming is to get rid of these limitations. With s, for example, you create a prototype of your very own data structure, a so called template:

    "lifeform"

    • 'visual' as objecttype, default mySprite
    • 'hp' as number, default 100
    • 'speed' as number, default 150
    • 'name' as string, default "Lion"
    • 'strength' as number, default 200

    "animals"

    • 'animal' as super, default "lifeform"

    Adding as many 'animal' to "animals" as you like, you can access them and their properties in various ways, e.g. Textbox.Text = "animals".'animal'(1).'name'

    You can go as deep in this tree, as you want to. For example, you could have another super "world", where you store "animals" among others. But still, you access everything as easy as Textbox.Text = "world"."animals"(2).'animal'(1).'name'

    You would also do the complete managing with s, it is not just an array of data. You can create objects, load and save every bit of data, including spatial data from your objects, and so on.

    There is a lot more, but as I said, 's' is quite complex, and you would need to be familiar with object oriented programming, but that is true for everything, which should work the way you want to have it working.

    You can try to make it work without Python (an object oriented programming language) or s, but it will be a pain, with a lot of workarounds involved.

  • For custom classes, there are much more elegant solutions. One of them is using Python, or, if you want to avoid the overhead, the fantastic (but complex) plugin 's' by lucid.

    Here is the link to the thread, but please make sure you download the newest version (somewhere on the last pages) AND read the complete first 3 to 4 pages to get an overview on how 's' works and what you have to take care of:

    http://www.scirra.com/forum/s-update-as-of-4-12-11_topic38456_page1.html?KW=plugin+lucid

  • bizla you ask on a thread that is more than two years old. Also, the one you adress to was last active 1 year and 5 months ago, according to his profile.

  • One of various methods:

    distributingletters.cap

  • I didn't have a look at zyblade's cap, but generally you just have to map the distance to the opacity by making it a relative value.

    1) First you decide, which values correspond to 0% and 100%.

    2) Now with those min and max values you convert the distance to a relative value.

    Example:

    minDistance (corresponds to 100%) 60 pixel

    maxDistance (corresponds to 0%) 500 pixel

    now you see that you need to map a range of 440 with an offset of 60

    t-value (the relative value you want to know)

    1 - (distance - minDistance) / (maxDistance - minDistance)

    Let's assume distance is 280 at the moment:

    1 - (280 - 60) / (500 - 60) = 1 - 220 / 440 = 1 - 0.5 = 0.5

    Or distance is 170 at the moment:

    1 - (170 - 60) / (500 - 60) = 1 - 110 / 440 = 1 - 0.25 = 0.75

    The term "(distance - minDistance) / (maxDistance - minDistance)

    " will always calculate a relative value from lowest to highest, so that in this example 60 corresponds to 0.0 and 500 to 1.0, but you need it the other way round. That's why "1 - " is added in the beginning. It reverses the result.

    You now have to multiply the result by 100 to get an opacity value in the range [0, 100].

    If you would use the above formula like that, you would also get values, if distance is outside your limits 60 and 500. For example, if distance is 610 at the moment:

    1 - (610 - 60) / (500 - 60) = 1 - 550 / 440 = 1 - 1.25 = -0.25

    But opacity only knows values between 0.0 and 1.0 (or 0% and 100%). That's why you can use clamp (it isn't really needed in this particular scenario, because opacity automatically clamps any value to the range [0, 100], but it doesn't hurt either and is good practice)

    clamp(t-value * 100, 0, 100)

    sets "t-value * 100" to 100 for any value that is higher than 100, and to 0 for any value that is lower than 0

    If you don't feel like calculating the t-value for yourself, there's the math plugin by lucid, which, if I remember correctly, has a function to retrieve a t-value.

  • I'd love to have my own data constructions to store them somewhere (e.g. to a hash table)

    Something like id, x, y, animation frame could be a simple string like "A19EB408"

    ACEs:

    hex2decimal

    returns the decimal expression of the hex-value

    decimal2hex

    returns the hexadecimal expression of the number

    sethex (hex, number, byte position, byte length)

    changes hex by converting number and change the specified part of hex ("A31C012B", 255, 3, 1 -> "A31CFF2B")

    gethex (hex, byte position, byte length)

    returns the decimal expression of the specified part of hex ("A31C012B", 2, 2 -> 7169)

    Good luck for the contest :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There are a few ways to achieve this. The easiest by far is to use the layer effect "Color Fusion (Masked)".

    If you follow the link above, you will also find 2 example caps. Both explain what you want to realize very well.

  • Bitwise operations! Finally Construct Classic grows up. Can't tell how often I wished for it to be present.

    Thank you :)

    p.s. now just add support for hex and I'm happy for months ;)

  • The unique ID is invalid according to the error message. Unless you give more information, I'd say you are trying to access an object that was just destroyed.

  • ...I gotta mention that I have searched around on the forum and google, but all the links I could possibly find was ... or B, not really what I was searching for...

    It would then be helpful if you would specify what exactly you are trying to find, otherwise you might get help that still isn't what you're looking for <img src="smileys/smiley2.gif" border="0" align="middle" />

  • Well, I am working with WinXP, so there certainly are path differences, but yes, that's the content I was talking about.

    Construct.ini

    data.bin

    Data.zip

    Python.zip

    Python26.dll

    (some TempX.exe files)

    TempUpdate.txt

  • It might be (never tested it) that the scientific notation is interpreted as a string. If it is, then any try to calculate with such a string would lead to a simple conversion (without further explanation for now :) ). In result the number would be 5 instead of 0.05 and could cause such unecpected jumps.

    If you're willing, post your cap or send it via pm, and I will have a closer look at it.

  • There are a few threads about timedelta, which should be helpful. But in short:

    timedelta is the time that has passed between the last tick and the current one.

    5e-002 means 0.05

    That means, that your game's speed was 20 fps at that moment.

    timedelta is always relative to the current framerate. If at times the processor doesn't have much to do and the framerate is e.g. 500 fps, then timedelta will be 0.002, at other times, when the framerate is only 10 fps, timedelta will be 0.1

    Timedelta assures to do something over time, if (and only if) used on every tick.

    If you do something like "a = a + 10 * timedelta", then a will raise by 10 per second, no matter the frame rate. But it does not evenly raise "a" per tick. It's just the opposite: it raises by whatever value is needed to get to a total of 10 per second, which may be a lower portion or a higher one, depending on the actual time, that passed between any two ticks.

  • I had a totally different problem once, but it also was the image editor (couldn't edit anything anymore). That's why I propose to do the following (at least it can't hurt):

    Navigate to your appdata-folder, look for the scirra folder and move (or delete) everything out of that folder, except for some third party files like the audiere.dll

    Everything else will be created the next time you start Construct. I don't know if it will help in this case, just give it a try.

  • Create a pv for object B, "timestamp", and fill it with timer (System/Get timer) on creation

    Add an event. Compare the pv "timestamp" against timer - (desired time in ms), e.g.

    + object B: pv "timestamp" less or equal timer - 1000

    -> object B: destroy

    EDIT: I'm sorry, this seemed to be posted in the CC Help section. But the basic approach still is the same^^