AmpedRobot's Recent Forum Activity

  • Joannesalfa

    Problem is, movemenet for a family of every instance of a sprite (there's not that many; maybe 2 dozen on screen) stops completely when I add dt (delta time) into the mix.

    Also, incredibly enough I tested the file on another computer and it works the same without dt. Not sure if it's luck or what.

  • Thank you, Kosiam.

    That's very interesting.

    So far I haven't used an array yet because I've been able to find simpler alternatives (such as spawning a random frame out of 54) for the same object for some variety, but I know eventually I'll have to get to arrays and that sounds like a very useful solution that affords a lot of complexity and control.

  • I don't want to knock Construct 2 because so far I've been able to do some amazing things with it and I plan to do a lot more, but, yes, it is scary when something that's supposed to work doesn't.

    I'm veering away from copying code between capx's too, for example, because that's making corrupt files and other weirdness. Keeps telling me I have some existing group which doesn't exist and more, even after rebooting.

    I'm also not doing some other shortcuts recommended in tutorials because they make weird stuff happen, so I'm working around the limitations of the software, at least for me.

    I'm glad it's working for you.

    Maybe it's because I'm on Vista, 64-bit.

  • I have what might be a dumb question, but maybe not.

    I have folders for as many as 50 different variants of an image and I know my final sprite is one of them, but is there a way to figure out exactly which picture the sprite is pointing to?

    If you double click on the sprite, it still just shows you your sprite name, but not the file it's pointing to?

    Reason I ask is because I wanted to back up my final images after lots of experimentation.

  • I just saw some terrifying code instability with very simple operations.

    I had a very simple capx file for testing purposes.

    All I did was copy some sprites from another capx and the same code would sporadically work, then not.

    All I was doing was:

    1) Keyboard/Right Arrow is down -> For each instance of Sprite/Set X to Self.X+3

    2) Keyboard/Right Arrow is down -> For each instance of Sprite/Set X to Self.X+3*dt

    The bizarre thing was that line 1 would work great initially, but as soon as I added a sub-event to roll another sprite at the same time, everything would stop working. Also, the *dt initially does not work at all (I know I mentioned this, but it's occasionally an issue), but would work sporadically after I removed the second family of sprites to be rolled.

    Renaming the family of sprites to be moved pretty much killed everything and the same code that worked a second ago would not work at all, even though it updated correctly in the events.

    Also, deleting the second family of sprites to be rolled suddenly made line 1 without dt go REALLY REALLY FAST (and never before).

    I was doing some funky things like opening up another capx within the first one, so maybe that screwed something up.

    Everything seems to go away when you import sprites properly (without copying between capxs) and remaking the code from scratch.

    It's just a bit scary.

    I know I should submit a capx, but I'd have to remake from scratch when I have the time.

    Just thought I'd mention.

    I'm on Vista 64-bit.

    Why dt does not work sporadically for me is a mystery, but I just tested the prototype on another windows computer and it works great without it, so I moved on for the time being.

    Still might be something worth looking into.

  • Wow, thank you both.

    My mistake on randomizing the sprite angle was assuming any of the sprite set angle options would work correctly with the bullet behavior whereas apparently the secret with setting the angle to "no" on the behavior was then to use the Set Bullet Angle of Motion. The code example I had was with "yes" which used the default initial angle from the sprite's properties, so I thought that was enough even with the "no" setting. Things like that are not immediately obvious to a newbe.

    On the second example, for randomizing the frame, apparently using the random function directly in the Set Animation Frame was the secret as opposed to linking it to a global variable. Since it was a sub-action with a system repeat function I thought it would reroll the variable on every spawn, but apparently not.

    Programs are sometimes picky and this one incredibly so (but no more than several others I've been learning).

    In any case, thanks again. You saved me hours of experimentation and frustration I would have had to go through tomorrow and I will use these functions for many things.

    If we had a central repository of working, useful code examples (as opposed to just searching the forums, which is often a miss), that might be worth the price of the software or more.

  • GenkiGenga

    I tried that:

    I have a Sprite with the bullet behavior. I Set Angle to "No".

    Then:

    Sprite -> Rotate random (360) toward random (layoutwidth), random (layoutheight).

    Sprite -> Set Angle to 90

    And they're still all pointing upright.

    I tried Rotate Toward Angle, Rotate Toward Position, Set Angle, and Set Angle Toward Position all to no avail. All the sprites are still pointing straight up/down, the direction they're moving in.

    klkitchens

    I also can't figure out how to pick a random frame for a sprite out of a set of its frames.

    I have a 54 frame sprite.

    I did a global or local FrameNo=0 for starters.

    Then:

    System -> Set FrameNo = floor(random(55))

    Sprite - > Set Animation Frame to FrameNo

    And nothing works.

  • Well, all the sprites would be going down or at 90 degrees, but I want them oriented or turned at a random angle.

    So say you have a sprite in the shape of a cross, instead of all crosses looking nice and uniform, they would be rotated by various degrees but still heading down.

  • Possible for a sprite with bullet behavior or another way?

    Basically want to set random orientation at start, but still want it to go down or at 90 degrees with the bullet behavior.

    Just trying to introduce some randomness, so it all does not look so uniform.

    I've tried like 5 different things so far and nothing is working.

    I know it's possible with a player sprite via orienting toward the mouse cursor while moving in another direction.

  • Would there be a more elegant solution other than designing 55 different if/then branches? With an array maybe? Instance variables off a spawner?

    Basically on Condition X (the rolled number from 0 to 55), I need to spawn specific objects for each number while randomizing their size and speed.

    I need to think on this some more.

    (It's late.)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you.

  • Hi.

    I need to set a flag between 55 specific conditions.

    Thought about rolling a random number, such as int(random (0,55)), but that would not be fair since there would be many fractional values, so in essence occasionally some numbers would be favored.

    Thought about using Choose (a, b, c) since that gives equal chance to a, b, c, but could not find how to access it in the software? Does not seem to be under System.

AmpedRobot's avatar

AmpedRobot

Member since 4 Jul, 2013

Twitter
AmpedRobot has 1 followers

Trophy Case

  • 11-Year Club

Progress

11/44
How to earn trophies