bilbonianswaggins's Forum Posts

  • 8 posts
  • Thank you Mikal, so I now have the following code:

    for(let i=1; i<4; i++){ for(let j=1; j<4; j++){ runtime.objects.Array.getFirstInstance(); runtime.objects.Array.setAt(Math.random(1,5),i,j); } }

    This no longer fails to build but using debug layout I can see the values in the Array are never actually set. I've played around with the formatting and am still not sure how exactly to express this (again, newbie, sorry). What is the proper syntax?

  • For reference, I am trying to create a simple slot machine in Construct 3 by utilizing an array to generate a 3x3x1 Array of integer values, each of which will be assigned their meaning elsewhere in the project. I do this using the Array object in runtime, and would like to access its values using javascript.

    When the user runs the slot machine, the following code should execute:

    for(let i=1; i<4; i++){ for(let j=1; j<4; j++){ runtime.objects.Array.At(i,j,1) = Math.random(1,5); } }

    Every time I run this code, the build fails, giving the error message "Assigning to rvalue 3:2".

    I'm sure this is a newbie mistake but if anyone can help me fix this code I would greatly appreciate.

  • You do not have permission to view this post

  • UPDATE: sort of fixed the problem by getting the reciprocal of the increments, giving

    X = 124+1/(random(-(Mouse.X-160), (Mouse.X-160)))

    Y = 78+1/(random(-(Mouse.Y-90), (Mouse.Y-90)))

    This does however create a weird glitch where the button moves to really far positions along the axes, so I now need help in fixing that.

  • Thanks for your reply, but using the programming that you've told me to use the button only vibrates towards the bottom right of the screen. I want it to vibrate moving around the center, not in an increasing direction. If you could tell me how to fix it based on my original equation, it would be greatly appreciated.

  • I'm not sure exactly what's wrong here, because any Sprite.Value should always return the number of that value. Is your program not returning a value, do you not know how to access it, or is it something else?

  • Just set the height and width to whatever number you want them to be.

    Ex.

  • You can't currently download C3 to your PC by itself, however you can run it offline via Chrome. In the Chrome menu, go to More tools >> Add to desktop. Chrome will create a shortcut on your desktop that allows the editor to run in the browser whether you are connected to the internet or not.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So for my start menu, I'm trying to create a button that vibrates more as the mouse gets closer to the center. My current programming for this is as follows:

    X=124+random(-(Mouse.X-160), (Mouse.X-160))

    Y=78+random(-(Mouse.Y-90), (Mouse.Y-90))

    If you can't make out what all this gibberish means, its purpose is to

    Set X to (the button's position) +/- a random number that gets exponentially bigger as the mouse gets closer

    Set Y to (the button's position) +/- a random number that gets exponentially bigger as the mouse gets closer

    This programming works fine, except the effect I want is inverted. Currently, the button vibrates more as the mouse gets further away, and less as it gets closer, which is the opposite of what I want.

    ___________________________

    UPDATE:

    I've sort of fixed the problem by getting the reciprocal of the increments, giving

    X = 124+1/(random(-(Mouse.X-160), (Mouse.X-160)))

    Y = 78+1/(random(-(Mouse.Y-90), (Mouse.Y-90)))

    This does however create a weird glitch where the button moves to really far positions along the axes, so I now need help in fixing that.

  • 8 posts