No luck with the Choose function

0 favourites
  • 9 posts
From the Asset Store
A collection of well organized sprites to build your own Xmas Luck slot game
  • I have a System event that every few seconds creates a sprite on screen. I'm trying to have the X location choose between the left or right side of the screen by having the X coordinate be "choose(100,1100)".

    The code works..... but ALWAYS places the sprite at the 100 location and never the 1100 location.

    Am I using this wrong or what?

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I beleive what you are looking for is the random function. In your case, random(100-1100).

    Choose only puts it at one of the set values, not a range.

  • Scenic Route Can you show a screenshot of the event sheet, or share your project?

  • I beleive what you are looking for is the random function. In your case, random(100-1100).

    Choose only puts it at one of the set values, not a range.

    No, I need it to be at 100 or at 1100 specifically. Nowhere in between.

  • I've set all the variables for Pirate to 0 so that it just shows up and sits still, so I can see what's going on. Every single instance shows up at X 100 (and a random Y between 20 and 300), none at X 1100. This is the only code so far that deals with the Pirate sprite.

  • > I beleive what you are looking for is the random function. In your case, random(100-1100).

    >

    > Choose only puts it at one of the set values, not a range.

    No, I need it to be at 100 or at 1100 specifically. Nowhere in between.

    My bad, I misread it.

    The image looks fine. Are you sure that there are no other factors that can affect this (e.x. an action that makes the sprite invisable being triggered at the wrong times)? You can try using Debug Layout to check if it is invisable when it spawns in or if it just isnt spawning.

  • Yeah, there must be some other event that changes the sprite position then. Perhaps "Pirate on created"?

  • Ready to hear the DUMB thing I did? I had the choose X option set to 1100 right?

    My layout is 1024 wide.

    I thought I had it set to 1280. DOH!

    Couple that with a "destroy outside layout" behavior, and yeah, my right-side baddies were nowhere to be found.

    All fixed now, and working exactly as intended.

  • Ready to hear the DUMB thing I did? I had the choose X option set to 1100 right?

    My layout is 1024 wide.

    I thought I had it set to 1280. DOH!

    Couple that with a "destroy outside layout" behavior, and yeah, my right-side baddies were nowhere to be found.

    All fixed now, and working exactly as intended.

    Wops. Alls well that ends well I guess, good luck on the project!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)