dop2000's Recent Forum Activity

  • It's a lot easier to manually place all socks on the layout, and then just randomize their images (animation frames). Say, you can make them initially invisible, and turn visible after you assign frames to them.

    For "p" from 0 to 11 // number of pairs
    
     Repeat 2 times
     Sock is NOT visible
     Pick random Sock instance 
     -> Sock set animation frame to loopindex("p")
     -> Sock set visible
    
  • I'm making an antivirus in construct

    Wow! What's next - an OS in Construct? :)

    You may be able to intercept win.close event according to the documentation:

    docs.nwjs.io/en/latest/References/Window

  • Instead of changing the font size, add the text to a hierarchy with a sprite — this could be the book page or an invisible sprite. The text should be a child in the hierarchy.

    Then, when you scale the sprite, the text should scale smoothly with it while preserving the line structure.

  • Ah, you need to load the array from AJAX.LastData, not from "Test"

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Did you move "Set text" action into "AJAX on completed" event?

    If that doesn't help, please share your project file.

  • Remove quotation marks from all strings in the array, they are not needed.

    After loading it, you should be able to access any line using Array.at(0,y) expression.

    For example, Array.at(0,3) will return: hello!

  • Array width=1 means that it only has one row on X axis. And array indices are zero-based, so array.at(1,1) expression is wrong - row #1 doesn't exist.

    Can you explain what are you trying to achieve? I see you are loading the array from a file, can you show a screenshot of that file?

    Also, move the "Text3 set text" action to event #2.

  • Say, if there are 20 frames in the animation, I would put 20 sprite instances on the layout - 4 in their places and 16 off-screen. Then assign them random frames:

    For each sprite order by random(1) : Set frame to loopindex

    Then destroy off-screen sprites. This is the shortest and easiest solution.

  • Btw I over-complicated it, you don't need a function or an array to achieve the shuffle, try this :

    With your code, if there are four instances of the sprite, they will receive frames 0–3. As I understand it, there are more than four frames in the animation, and OP wants to assign random frames without repeats.

    Yeah, there are many ways to do this, even in C2, but none of them are very straightforward.

  • I don't think you need an array here. If there are only 4 frames, then it's very easy:

    For each Sprite order by random(1) -> Sprite set frame to loopindex
    

    If there are more than 4 frames in the animation, you can use the Advanced Random object.

    AdvancedRandom create permutation table with size Sprite.animationFrameCount
    Sprite set frame to AdvancedRandom.permutation(self.IID)
    
  • You can't use "Get" action without checking if the item exists first. Here is how to fix your code:

dop2000's avatar

dop2000

Member since 26 May, 2016

Twitter
dop2000 has 279 followers

Connect with dop2000

Trophy Case

  • 10-Year Club
  • Entrepreneur Sold something in the asset store
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • 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
  • Forum Wizard Made 5,000 posts in the forums
  • Forum Unicorn Made 10,000 posts in the forums
  • x5
    Popular Game One of your games has over 1,000 players
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • Enduring Visitor Visited Construct.net 90 days in a row
  • Unrelenting Visitor Visited Construct.net 180 days in a row
  • Continuous Visitor Visited Construct.net 365 days in a row
  • RTFM Read the fabulous manual
  • x3
    Quick Draw First 5 people to up-vote a new Construct 3 release
  • x14
    Great Comment One of your comments gets 3 upvotes
  • Delicious Comment One of your comments gets 10 upvotes
  • Email Verified

Progress

30/44
How to earn trophies