[SOLVED] Picking, for each loop, making things cleaner..

0 favourites
  • 4 posts
From the Asset Store
For Adventure, Action, Heroes, Sci-fi and Action-RPG games.
  • I'm looking to make a game similar to this one: http://www.ferryhalim.com/orisinal/g3/wings.htm

    I managed to make it work as intended as least for a starting point, I usually like to have an idea of how I'm gonna build the whole game before starting and since I'm not very familiar with Construct's picking system I came here ask for some help before going on in this game.

    I've a programming background but I seem to get pretty lost with all this blocks structure, so any tips are also welcome.

    Please have a look at the capx, mouse control main bird, click spawn follower bird at random position, you pass over a bird and it starts following you.

    My question is "How do I 'maker it better/cleaner' ".

  • Hey looks good. No time to go in depth but just some surface stuff.. You don't need the System:Every tick before the Mouse:Right button is down. You have a duplicate event (10 and 11). You could have 1 expression at event 16 like System:Pick GoodWing by evaluating GoodWing.lineNum = 0 & GoodWing.pickedUp (although that's personal preference). You could use groups to make it cleaner (as it gets bigger).

    Apologies if that's too basic stuff that you already knew

  • Ok looking at the bird following events: the first two things that stand out are what codah already mentioned. No need to have everything under an 'Every tick' condition because the events run every tick anyway by default. And events 10/11 I guess were a copy/paste error.

    Then, there's no need to use the system pick conditions when there is a sprite picking condition that does the same thing. For example, you use both 'GoodWing: Is PickedUp' and 'System: Pick GoodWing by evaluating GoodWing.pickedUp' conditions that both do the same thing but the first is more readable. Also, 'System: Pick GoodWing where GoodWing.lineNum = 0' could be just 'GoodWing: lineNum = 0' (Sprite: Compare instance variable).

    All the GoodWing picking events have an 'Is pickedUp' condition, so you can take that out and move it up the top below the 'else' as it applies to all sub-events.

    And finally for the looping, instead of looping PickedCount times and keeping track of an index and so on, you could use 'System: For each (ordered)' to loop through each GoodWing ordered by lineNum.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • codah ramones

    Thanks so much for taking your time to have a look at it.

    At first I didn't have the mouse clicks to group them all together, that's why the every tick event was there, I completely forgot to take that out though. Thanks for pointing that out.

    10/11 were a copy paste error for sure. my bad.

    About all the picking conditions, that capx was exactly what I was looking for, I didn't know I could use for loops ( although their pretty basic stuff in proggraming, I was like "how can the engine don't have it" ).

    Now it looks clean and everything makes sense. About the topic, I messed around alot with the picking stuff while writing the topic and forgot to change the tile.

    Thanks guys.

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