AmpedRobot's Recent Forum Activity

  • Hey, guys.

    There's something I'm having trouble with.

    Trying to make a random instance of a ship in a family fire 2 shots of 1 type, then 1 shot of another type, then switch instance.

    I tried it various ways with sub-events where it should have worked and for some reason it doesn't.

    The attached capx is the final version where I fell back on groups as a last resort, but that just made all the ships fire at once.

    http://www.darksunpictures.com/public/A ... _SHOTS.zip

  • Addendum

    I figured this out with a multi-line function calling from the For X loop, but if anybody has any cool code they want to share, let's go for it!

    Basically, my current spawn ratios rely on randomness which means the correct spawn ratio does not always get called.

    I did controlled chaos before (within a range).

    I'd probably want a call to an array for exact spawn ratios and it'd be nice if the sequencing was random.

    But this post is solved for all intents and purposes for now.

  • Hey, guys.

    Got a question.

    How would I code something in a single line to be able to control various percentages of the ships which spawn on screen?

    Currently I have this set up as:

    set type (local variable) to choose (1,1) or choose (1,2,3,4,5...) etc, but no idea how to even set this up to accurately control spawn ratios of different ships on screen.

    Basically I have a lot of different ship types, but rather than just revealing them all at once in a random version, I found that a slower timed reveal works better, feels

    way more video gamy.

    There's generally about 10 ships total on screen at a time with the spawner I have set up.

    I have a time variable TimeCount

    so let's say TimeCount>5

    spawn just 1 ship type

    --

    TimeCount>200

    spawn 1 ship of Ship Type 2 for every 9 ships of Ship Type 1

    TimeCount>400

    say spawn 3 ships of Ship Type 5 for every 7 ships of Ship Type 3 etc etc

    Basically, it gets pretty hard to do with the choose expression.

    Something with percentages that's very compact that could fit in a single line of code (maybe with calls, functions, etc.) that works well with a For Each X element of an array loop would be great here.

    ?

    Any ideas?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Scratch this.

    It does actually work!

    Just made a simple capx from scratch, so no idea what happened ha ha.

    Thanks for all the replies.

    This concludes tonight's presentation.

  • 99Instances2Go

    Thanks, man. You obviously know what you're doin, but I've already implemented my ROJO modified code for this. I will process your solution at some point because it seems to be a long time programmer's solution.

    99Instances2Go

    Still tryin to do the shooting though with multiple image points. Not hard to setup with instance variables for each ship type, but gets complicated trying to control the rate of fire of many different ships.

    The simplest solution I had before, which worked very well, was:

    Every x seconds

    Pick a random instance Sprite -> Sprite - spawn bullet

    Replacing Sprite with a Family of say 20 sprites did not work (think they all fire simultaneously).

    Is System ->Pick Random Instance equivalent to Pick a Random Family Instance? Where is the family random instance picking or is it the same?

    Maybe I'm just not seeing that option anywhere.

    Found a Scirra tutorial on picking family instances and it will take hours to test absorb, but I do not believe I want to mess with UIDs or anything that fancy.

  • Thanks a million!!!

  • So for frame 1 cycling, frame=1?

  • Ok, lemme test.

    That would simplify my life quite a bit.

  • Would there be a way of grouping many different sprites on screen for comparison purposes?

    I just discovered the "pick all instances" and "is on screen".

    So how to use that for say 5 different ship/sprite types on screen and then pick a random instance out of all that?

    Is that possible?

  • Thank you, ROJO.

    You are the master, as always.

    That is a very neat way of programming.

    I haven't seen it before.

    Nice!!!

    Thanks again.

  • Yup, the Else fixed it for the 4 spawn (think i hit reload 15 times to test), but not for the 10 max spawn version or 7 for that matter (probably values larger than 4 for the spawned ships).

    http://www.darksunpictures.com/public/LARGERCAPX2.zip

  • I'm not clear what the issue is. In the initial capx you wanted to create multiple sprites and have each one have a different frame. The solutions you got so far seem to correct that.

    Your Larger capx just creates four different sprites. I can't tell from your descriptions how you want it to want it to work. and in what way the result not correct.

    Oh, hi, ROJO.

    Yeah, I threw a lot in there, but that's all easily programmable by me.

    Basically, in the larger capx I posted, the only difference is the spawned ships do not have static positions, but variable horizontal positions based on an array which picks some random non-repeating values out of a larger array and sorts them in ascending order and THERE the engine wash does not alternate. I just want it to alternate and I need the 4 frames. So no idea why that's happening. It only works sporadically right now, so gotta hit the F5 key a few times to reload to see it.

    So basically I need:

    spawned ship 1 starts at frame 0

    spawned ship 2 starts at frame 1

    spawned ship 3 starts at frame 2

    spawned ship 4 starts at frame 3

    spawned ship 5 starts at frame 0 (need to change the random values in there to 5 to see that)

    spawned ship 6 starts at frame 1

    etc etc depending on spawn size

    ---

    and maybe an alternate version if this proves complex

    so

    spawned ship 1 starts at frame 1

    spawned ship 2 starts at frame 2

    etc etc

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