AllanR's Recent Forum Activity

  • Alon

    yep, just a tiny mistake - event 13 should have "less than or equal" (like event 12), not "greater than"

  • Reneczech

    I have a much more advanced version that I was playing with - the trains start and stop much better, and can go in reverse, I added switches - you click on a switch to change its setting.

    currently switches don't work when the trains are going in reverse. and collisions will take some thought, and will probably require adding independent train controls (they are still just random speed, and they all start, stop and accelerate together).

    I might have a little time later tonight... and will post the updated version when I can. (I will post again to say a new download is available).

  • Try Construct 3

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

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

    on her laptop, I would check Display Settings, scroll down to the Scale and Layout section and see if it is zoomed in there. Set that back to 100% and you will probably be ok.

    I went back and found the rest of last years eggs... I almost gave up at 49. The last two levels were challenging!

  • Alon

    in the sample I made, there were only 3 fields for the characters: total_slots, Active_slots, and CharacterName. So with only a few fields like that, it would probably be easiest to set 3 global variables after choosing the character. And then set the player's character from the global variables.

    if the player was picking a team of characters, then an array would be a good option.

    to use a hidden sprite to hold the selected character's variables, you would have to make that sprite a global object (in the Object Type Properties). Then it would still exist on each additional layout...

    I just tested that idea out, and actually, that would be a good way to do a team of characters too - easier to work with then an array.

  • Alon

    I would use instance variables on the character - much easier to keep track of how many a character can have, and how many they do have.

    I put the Used_slot animation in the Active_Slot sprite, and renamed it Orb. Then there is only one type of object to worry about, and you can tell its status by what animation it is playing. The orb has an instance variable telling which character it belongs to.

    at the start of the layout, it creates all the slots for each character, and makes the correct number active...

    https://www.rieperts.com/games/forum/orbs.c3p

  • yeah, that tells php to insert the correct control characters...

  • Fengist

    newline is essentially a variable for the control character that causes a line break. So when the text is read from the jason, it only sees the characters the spell newline, not the actual control character (which is Hex 0D or something like that)...

    so, when you assign the text, you need to use Replace.

    Set Text.Text to Replace(jsontext, "newline", newline)

  • john Cutter

    impossible to say without seeing your code...

    I wouldn't think the image size would be a problem.

    those are well hidden eggs! I found 8 before I decided I should get back to work...

  • klabundee

    to do a nice 3d flip like your image shows, then newt is correct - and I am pretty sure I have seen an example (probably by ROJOhound) on how to do it a couple years ago.

    another cheap effect you can do is adjust the width down to nothing, then bring it back up to the card width. It doesn't look as nice, but takes very little processing power, and no plugins...

    and if you do it fast enough, it is hard to tell the difference.

    https://www.rieperts.com/games/forum/cardflip.capx

    my sample has a deck of cards from a tutorial I saw years ago that has a nice shuffle example and other ideas to get you started on a card game... not sure if the tutorial still exists or not.

  • you can also use "Set Vector X" to do a dash (it is limited by the max speed, so you would also have to increase max speed for the duration of the dash).

    platform can do just about anything and handles a lot of the work for you. You can turn off gravity, change the angle of gravity, and lots of other things to achieve whatever you want...

  • Sofa_King

    another comment is why do you need to re-shuffle the temp array, when the act of picking 4 answers randomly from the larger array already puts them in a random order?

    if you still have trouble. make sample file with the json data, the 20 item array, the temp array, and the 4 text answer fields. It is much easier to help when we have something to work with - and seeing the actual data can quite often lead to suggestions you might not have considered.

    To me, the top image in your first post looks like it should already be giving you a shuffled result, and it deletes the picked answer so you shouldn't get duplicates.

  • Sofa_King

    he is subtracting one in the first event because arrays are zero based... so if the array has a width of 10 (10 values stored in the array), then those entries will be numbered 0 to 9.

    the routine starts with the LAST entry in the array and picks a random entry up to that point in the array and swaps the values. And then does the second last one, etc...

    so at the end of the loop, each value in the array has had a chance to be swapped at least once.

    the tempValue variable is a text variable, so it will work with text values.

    if you don't have the -1 as shown, you could end up swapping with a value outside the array limits - which would probably give you a zero value.

    to walk through the logic: (for an array with 10 items)

    the first time the loop runs, loopindex will be zero, so randomindex will be int(random(10-0))

    note that random will pick a number up to, but NOT including the limit you give it, so in this case it will pick a number between 0 and 9.9999... and then take the integer portion (to give you a number between 0 and 9).

    then it sets tempValue to the last entry in the array (which is 10-0-1), and then swaps that value with the randomly picked entry.

    then the loop repeats, loopindex will be 1, so randomindex will be a number between 0 and 8, and the second last entry (10-1-1) is swapped with that.

    repeat, loopindex will be 2, randomindex will be 0 to 7, swap with (10-2-1) or 7th entry

    The final time the loop runs, loopindex will be 9, so randomindex will be 0, and it will swap with itself (10-9-1).

    This guaranties that every item in the array has had a chance to swap with another position in the array.

    EDIT: just looked at your shuffle code, and the reason it was not working is that "pick" could choose the same value multiple times, and that would result in loopindex getting overwritten in the array, and then you would also have at least other array value never getting set. You would have to use a method that must pick a unique value. (the tutorial you linked to put 4 values in a temp array, and then deleted the picked value each time through the next loop so it could not be picked again).

AllanR's avatar

AllanR

Member since 21 Nov, 2013

Twitter
AllanR has 23 followers

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Popular Game One of your games has over 1,000 players
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

20/44
How to earn trophies