6bf85f30-2578-4227-841b-41a0007077df's Forum Posts

  • Your current conditions are saying if any sprite exists with animation1 set then add 1 and the same for animation2 so I imagine they just increase by 1 every 1 seconds. The fix for this is actually to replace add 1 with add sprite.pickedcount. Pickedcount is the number of sprites currently set to that animation.

    Ooohhh.....yeah that sounds like exactly what I'm looking for. Thank you! However...where would one find that "pickedcount" and use it?

    Further digging yielded it. Testing now.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • C3! How the heck are ya?

    In my little project, I want to have the sprites with animation 1 showing to add to totalups (global number) or add 1 to totaldowns (global number) for animation 2. That works but it seems no matter how many sprites I have showing animation 1 or 2, the rate that the number goes up is the same.

    I'm including the scaled down, simplified version of what I'm using in my project since I was able to replicate my coding inability.

    I appreciate any and all help/suggestions.

  • Got it!!! Thank you for your patience and explanations!

    Changed the circled portion from BuildOption_Sprite to the BuildOption family.

  • You need to use the same object, that build family is a different object and you don't need to use that. Also in terms of structure add Pick all sprite as a sub event then indent again for the other conditions.

    Oh, so I can't use one sprite (Sprite) to set the animations of another (BuildOption_Sprite)?

    Disregard.

  • Thank you very much for the direction!! Major help.

    I deleted my previous replies as I re-re-read your reply and think I got it now. How does it measure for code standards?

    However when used in a new block, same error but the coding looks the same except the sprite referenced is different (was Sprite - used on the board, now BuildOption_Sprite - used in the menu). Only the BuildOption_Sprite selected changes, the others disappear.

    Black square where oil derrick should be (SlotID=1, animation=1)

    If the function/parameter will help, I'm all for it but will need a little push in the right direction.

  • Hey C3! Since being shown the many options available using sprites and frames, my project has drastically fewer "spawn" or "create" object codes. [thank youoosyrag!!]

    Now that I'm getting more familiar with the frame/animation direction, I thought I would use them for this menu.

    I created a sprite called BuildOption_Sprite with an instance variable of SlotID and copied the sprite so there are 4. Then when the user picks one of the 4 frames, the animations would change based one of the 4 the user picked. This would trigger four 4 frames to appear. At least, that was the idea.

    Instead, when the 4 options are available, the animation only changes for the sprite you picked, not all. Any help coding this would be appreciated.

  • You do not have permission to view this post

  • Hey there! I appreciate your reply.

    I suppose I don't need to. This is more of my "testing sandbox" code to learn conditions/functions that I'm not ready to mix into my long-term project. I didn't understand the spawning function and was trying to learn how it worked.

  • Hey fellow C3'ers!

    Trying to get the right coding for an object (stoplight) to spawn on a sprite if conditions are met (sprite.value = 0). When the value increases to 1 or higher, the object (stoplight) should disappear. If the value drops again to 0, back it comes. And so on.

    What's the best way to make this happen? I've tried so many combinations of conditions and actions but am making no ground. Any help/guidance is greatly appreciated.

  • Made some changes to match up better with your suggestions. It looks/feels better so thank you for the advice. Please confirm this is what you were recommending. Also, is there a way to code the condition to read (Animation frame = 1,2 or 3) instead of putting multiple conditions of animation frame =1, animation frame = 2.... etc.

  • It's not a big deal in this situation, but as a general good practice don't let any event run every tick if it doesn't need to (event 5).

    Basically your objects don't need to change unless sprite.cows changes, and sprite cows will only change on user input.

    So in this case I'd probably make it a function that gets called as an action in events 9 and 10.

    Normally though, I would put the whole thing as a subevent of a trigger if I could, similar to what I did in my example.

    Fair enough. Based on your suggestions, I'm going to revisit the test project and see if I can make those changes as for now, the sprite cows will only be impacted by user input.

    I noticed with your example that if I go down 1, the counter hits -1, then I hit plus 1, counter goes to 0 and the plus sign goes away. I didn't try changing your coding or figuring out why that occurred but used the overall design to model my latest code. Very eye/mind-opening example, as simple as it was.

    I get what you're saying and it makes a lot of sense. I just need to do some more testing it appears. Thanks for the follow-up and your time/advisement!

  • 'Initial Frame' in object properties.

    This seems to be one of those "teach a man to fish...." sort of experiences as you've completely changed the way I approach the coding of this game. The example you provided was a tremendous help and not sure anyone has provided that for me before...thank you!)

    If this project ever gets big, I'll make sure you get the credit (maybe oosyrag will be a secret code word somewhere in this..)

    Final version (unless you see something I need to tweak)

  • quick dumb question, how did you use a dif animation on the sprite in the layout page (plus and minus images)?

  • Is there a particular reason you have to create and destroy your interface objects?

    Sadly no, no particular reason beyond being a newb and not very versed. :)

    Thank you for the example! I am reverse-engineering it now..

  • progress!! I either create a million (remove trigger once) or none (add trigger once)...