c4sp3r89's Forum Posts

  • I've put the steps in a pdf. Try following it.

    https://www.dropbox.com/s/eiqhmo85nfl3m ... g.pdf?dl=0

  • Problem Description

    Save a loaded save state (Save -> Load -> Save the loaded state -> Load) and call "Restart Layout" will cause object created using "Spawn another object" action to be messed up.

    *If "Restart Layout" is not called, error will not occur.

    Attach a Capx

    https://www.dropbox.com/s/jd4hpqax5p6nt ... .capx?dl=0

    Description of Capx

    Capx shows the problem created by "Spawn another object" action VS "Create object" action. At the start, text on the left, in the yellow box was created using "Spawn another object" whereas, text on the right, was created using "Create Object". Each text was numbered 1-3.

    Steps to Reproduce Bug

    • Run the project at "Login" layout (Shortcut key, F4).
    • Click on the red "Save" box.
    • When the text at the top contained "-Saved-,", refresh the browser page or re-run the layout.
    • Now the text at the top should show "-Loaded-,-Restarted-,". Saved it again.
    • When the text at the top contained "-Saved-,", refresh the page.
    • At this point, the text, on the left in the yellow box, created using "Spawn another object" messes up.

    Observed Result

    All text created using "Spawn another object" was set to the same text.

    Expected Result

    All text created should be set according to their number.

    Affected Browsers

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

    Operating System and Service Pack

    Windows 7 Home Premium, SP 1

    Construct 2 Version ID

    R190

  • I made the following changes to your capx.

    1)Set the animation speed of "objects" to 0.

    2)On start of layout, set "objects" bullet angle to 180.

    3)On create "objects", set animation frame to floor(random(Objects.animationframecount))

    dropbox.com/s/0v0j0l3spfcfdt6/EndlessExample%28Allbrotnar%29.capx

  • Condition:

    -On start of layout.

    --For each sprite

    Action:

    -Sprite > set angle random(360)

  • Set the animation speed of that animation to 0.

    Open up the image editor, at the properties panel on the left. set animation speed to 0.

    It will stop the animation from playing.

  • On your 1st post. You state that you need to random 10%,30%,60%.

    Your 1st example:

    on "function"

    random(100) < 10 -> return 0

    random(100) < 30 -> return 1

    random(100) < 60 -> return 2

    which will random(100) on each condition which will be something like:

    55 < 10

    20 < 30

    80 < 60

    which will already give the wrong random chance.

    Your 2nd example:

    on "function"

    random(100) < 10 -> return 0

    else random(100) < 30 -> return 1

    else random(100) < 60 -> return 2

    will follow the same thing. Except that it won't run through all 3 condition when the previous condition is met.

    30 < 10 (false, go to else)

    12 < 30 (true, skip the rest)

    It will basically give the wrong random chance also.

    Another example to explain clearer:

    I create a variable rand to store the random once.

    variable rand=0

    rand = random(100)

    Using the same variable, check through all 3 conditions.

    eg. rand=30

    if(rand >= 0 && rand < 10) // 10%

    return 1

    if(rand >= 10 && rand < 40) // 30%

    return 2

    if(rand >=40 && rand < 100) // 60%

    return 3

    Does this give a clearer view?

  • variable rand=0

    rand = random(100)

    if(rand < 60)

    return 2

    if(rand < 30)

    return 1

    if(rand < 10)

    return 0

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I would do it as such:

    variable charString="0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z"

    variable randString=""

    Condition:

    -On start of layout

    -Repeat 25 times (the length of the string to generate)

    Action:

    -add tokenat(charString,floor(random(25)),",") to randString

    To get the char of a certain index in the randString, use expression mid(randString, 0, 1), this will get the 1st char of the randString.

    Reference to using tokenat,mid,random:

    scirra.com/manual/126/system-expressions

  • Create local/global variable, intTotal = 10

    1) create an array

    2) before you start for loop, array set size intTotal,1,1 (this will give you a 1 dimensional array of intTotal length.

    3)

    Condition:

    -for 0 to (intTotal - 1)

    Action:

    -array, set at x. value = intValue

    OR

    1) create an array

    2) before you start for loop, array set size 0,1,1 (this will give you a 1 dimensional array of 0 length.

    3)

    Condition:

    -for 0 to (intTotal - 1)

    Action:

    -array, push end of x. value = intValue

    Reference:

    scirra.com/manual/108/array

  • -Pass Enemy.UID into the function as parameter.

    -Inside the function. Pick enemy by UID - Function.param(0)

  • Maybe provide a capx?

  • Go to the layout. Deselect by clicking on any empty area. Then under the properties bar on the left, click on "Project Properties" view. Set your window size to your layout size.

    Some references:

    scirra.com/manual/66/projects

    scirra.com/manual/67/layouts

    Try reading up on the manual.

  • Maybe using a container?

    scirra.com/manual/150/containers

    -Select your character instance object.

    -At the properties bar, under "Container" click create...

    -Select the array object to be linked to the character instance object.

    -Set the selected array "Global" to "No"

    In this case, everytime a character instance is create, a unique array is also being created and tagged to the instance. To get/use the array of the particular instance, just pick the character instance and you can access the array straight(you don't have to pick the array separately).

  • try something like this.

    Condition:

    -Every x Second

    --for each Mob

    ---Distance(Mob.x,Mob.y,Structure.x,Structure.y) < (Your pixel distance)

    Action:

    -Mob Attack

  • add tile background object into your project.

    add image to the tile background.

    Resize.