R0J0hound's Recent Forum Activity

  • Construct uses doubles for the numbers so the largest number is around 10^308. It's most certainly a bug:

    You can get around it by doing this:

    global number ten = 10

    money > ten^18

    money < ten^19

  • Problem Description

    When you put an expression like 10^20 in events it is calculated wrong.

    Attach a Capx

    https://www.dropbox.com/s/vv6hmwuk77fp1 ... .capx?dl=1

    Description of Capx

    It does two simple expressions and displays the result.

    v1 = 10^20

    ten = 10

    v2 = ten^20

    but 10^20 calculates wrong and ten^20 calculates correctly.

    Steps to Reproduce Bug

    • Write 10^19 in an expression. 10^18 works, but 19 and higher doesn't.
    • It must be an issue with the constant folding since we can bypass the bug by using a variable ten=10 and then doing ten^19 to get a correct value.

    Observed Result

    v1 = -9223372036854776000

    v2 = 100000000000000000000

    Expected Result

    v1 = 100000000000000000000

    v2 = 100000000000000000000

    Affected Browsers

    • Chrome: (YES)
    • FireFox: untested
    • Internet Explorer: untested

    Operating System and Service Pack

    win10

    Construct 2 Version ID

    250 x64

  • If you move the island over the path so they are lined up and save the x,y position of the island to some vars: startx, starty then you can have some sprite dummySprite that you move along the path as normal, only you'd make that invisible. Then you can move the island anywhere and set the position of another sprite to

    x = island.x+dummySprite.x-startx

    y = island.y+dummySprite.y-starty

    and the path will move with the island.

  • Just use it instead of the first code. I kind of paraphrased the expressions but it should be useable. At the end of it the highest value will be

    Array.at(index1)

    And the second will be

    Array.at(index2)

    You’ll want to reset both vars to 0 before running that event.

    If there is a tie then then it will still work. Barring any flaw to the idea.

    edit:

    Actually that won't work right for finding the second highest value in some cases. Do this instead: loop over the array twice. Again you'll want to reset the variables to 0 before running the two loops again.

    global number index1=0

    global number index2=0

    array: for each x

    compare: array.curvalue >= array.at(index1)

    --- set index1 to array.curX

    array: for each x

    compare: array.curx != index1

    compare: array.curvalue >= array.at(index2)

    --- set index2 to array.curX

  • I suppose. I’ll try to give a possible example.

    But it’s probably simpler to sort the array. If you want to remember the original indexes, you can add another column and set the values there to the indexes before sorting. If you want to leave the original array alone, you can copy it to another first with the asjson expression.

    var index1=0

    var index2=0

    Array: For each x

    Current value <= array.at(index1)

    —- set index2 to index1

    —- set index1 to curx

  • You probably can use a dictionary. It’s just something you’d have to try. You can loop over the values much like the array to find the highest value.

    Instead of that expression with max you could do

    var highest=0

    var index=0

    Array: for each x

    Compare: array.curvalue>highest

    —- set highest to array.curvalue

    —- set index to array.curx

  • I got bored of finding a simple solution. You could just use one sprite with on animation with all the frames. The second object would just be a separate instance. The animations are just lists of frames, and categories are just lists of animations. The frame value, if different per animation could be included in the animation list.

    The lists could be done with arrays, text variables or whatever. Getting the data into the arrays isn't too bad. Dop listed a few solutions but there are more.

    The algorithm itself is straightforward imo. Just implement it as you say.

  • I notice that you have identically named pictures for separate animations, are they meant to be identical pictures?

  • Couldn't you make it in Construct, and save a series of png files and use something else to convert them to a gif?

    Making the gif directly could be possible from javascript but there is nothing setup for that currently.

  • A few ways come to mind:

    One is to use the audio plugin's level monitoring effect, or whatever it's called. There is an example capx that comes with C2 that shows how to use it. It's good for visualizing the music, but may not be suitable to read the beat like you want.

    A second way is to manually list all the times of a beat in the song, or something like that. You may be able to use some audio software to help with that or maybe you could make a tool in C2 to assist and make things easier. I'd imagine this is mostly what things like ddr does.

    You could also use a music format like midi that has the sheet music of the song that you could pull the timings from. There may be some audio processing magic that could assist with things but that's not quite simple.

    You may get some other ideas/solutions by searching the forum for previous discussions about this kind of thing. I know it's been discussed a few times before.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you have each card as a separate instance, you could do this

    For each sprite ordered by random(1) ascending

    —- sprite: set animation frame to loopindex

    If you want to just get a number one at a time you can either make an array with all the numbers and randomly taking one out. Blackhornet also made a nice plugin to do that.

  • Positioning with events can be as easy as setting an object position to another objects position or one of it's imagepoints.

    You can also save the offset and just set the position from that. Like this more or less. There are more deluxe ideas too.

    Start of layout

    --- set dx to child.x-parent.x

    --- set dy to child.y-parent.y

    every tick

    --- child: set x to parent.x+dx

    --- child: set y to parent.y+dy

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 157 followers

Connect with R0J0hound