Pick Object Type in Family [C2] [SOLVED]

0 favourites
  • 5 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • Hey, guys or plinkie specifically!

    Alright, here's that capx.

    I'm trying to set up separate ship firing patterns.

    If you'll notice in the capx, there's 4 different ship types - based on color (t1, t2, t3, t4).

    I can't figure out or find on Google/Scirra how to code when a specific ship type (t1, t2...) is picked as a random instance and then link it up to the firing pattern instead of "ship_type" which obviously makes no sense in there right now.

    Only coded 1 firing pattern for now, but pretty easy to change with just copy and paste.

    You mentioned something that "picked instance" exists somewhere I believe, but I've never done it before so no idea how to code.

    http://www.darksunpictures.com/public/R ... _MODIF.zip

    I did this publicly because the pm system is weird. Some of my messages sit in outbox for days.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There you go https://www.dropbox.com/s/4u3skfkbf1612 ... .capx?dl=0

    The logic can be tidied up even more with a function, it really depends on what randomness is supposed to happen.

  • Plinkie, am I wrong, but is this assigning random numbers to the ship types via "choose" and "pick", so they are only sometimes the same?

    I actually wanted the same firing pattern for each different ship type consistently. So say ship type 1 or t1 would only fire green shots, ship type 2 or t2 would only fire red shots.

    Is that possible?

    I guess the question is; how can one compare a specific object type picked via random instance in a family?

    Or is the only or better way of doing this via specific family instance variables setting everything up separately for each ship in terms of firing pattern?

    I guess I was looking for a convenient shortcut if one exists.

    Also, not really sure how to avoid each ship of a specific type from firing the same, some sort of random roller for the cooldown instance variable?

    It gets pretty hairy 'cause I have a lot of different ship types and if you start using similar logic without one all encompassing algorithm things break down.

    That's sort of the boat I am in right now. I designed a lot of different shot spawners, but it's similar logic, so they malfunction when there's multiple ship types on screen.

  • Anything is possible, just explain exactly what you want to happen.

    This one picks a ship at random, and each ship type has the same assigned fire type. https://www.dropbox.com/s/so9p2jdpzbsse ... .capx?dl=0

  • OMG, Miraab his sails unfurled!

    <------You're dealing with a 40 year old brain here, so I guess it gets foggy sometimes when I have to deal with new concepts, plus so little brain space left after I had to learn all the other stuff to make this game.

    This is great, thanks.

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