How to Appear coins in a spl pattern in FlyingAlong

0 favourites
From the Asset Store
112 High-Quality Coins and Chest SFX specially crafted for video games
  • In FlyingAlong sample game of C2 I want to collect coins in this game

    but problem is i want to appear coins in any special format or special pattern

    Please help me if this is possible

    3 Example Patterne

  • You could create a group of functions like this:

    on function "group1": (this function creates 2 coins vertically)

    • create coin at 800, 200.
    • create coin at 800, 300.

    on function "group2": (this function creates 3 coins diagonally)

    • create coin at 700, 150
    • create coin at 750, 200
    • create coin at 800, 250

    These functions basically create coins at the specified locations upon being called.

    Now, what you need to do is you need to create the coins in the formation you want. To create stars or other interesting shapes, you need all the points of those shapes and apply all of these coordinates into the position of each coin being created.

  • Create a coin sprite with a bullet speed set to minus and make it ready off screen to the right.

    Create copies of the same coin sprites and arrange shapes.

    Here's an example.

    https://www.dropbox.com/s/0owwgi68eo77h ... .capx?dl=0

    If I were to make multiple coin shapes, then I would arrange them so the bullet settings are disabled by default and only activated when needed. (e.g. Wait for 35 seconds for the second shape, Wait for 45 seconds for the third shape, etc..)

  • ..or you can fill array with 0&1

    array2Coins.capx

  • korbaach I like your example

    but I am not understanding what you have done in this

    on "shape0", "shape1" & "shape2" its totally out of my mind

    only one thing i understand here

    that is All the shapes here, you have made totally in event sheet, not in the layout manually by positioned each coin Separately

    .

    If you have time please explain what is the logic here and how its working ??

  • I'll try my best...let's start with something simple..

    Coin 32x32 on 32x32 grid

    This can be represented as Array(7,7,1) where 0= empty space & 1= Coin

    "{""c2array"":true,""size"":[7,7,1],""data"":[[[0],[0],[0],[1],[0],[0],[0]],[[0],[0],[1],[1],[1],[0],[0]],[[0],[1],[0],[1],[0],[1],[0]],[[1],[1],[1],[1],[1],[1],[1]],[[0],[1],[0],[1],[0],[1],[0]],[[0],[0],[1],[1],[1],[0],[0]],[[0],[0],[0],[1],[0],[0],[0]]]}"[/code:2jutcyy8]
    
    to get this array code you need just one smaller sprite 
    [img="http://lookpic.com/O/i2/352/pA9q0xul.png"]
    and some simple code to check each position for coin
    [img="https://media.giphy.com/media/l2SpVIcPQSidr38L6/giphy.gif"]
    
    [url=https://app.box.com/s/vp6w19dyzxdwu0ctq9zfcwwjxc0iw92g]coinsEditor.capx[/url]
    
    that was the first part..now you can open pattern.json file in text editor and copy code to your capx
    
    [url=https://app.box.com/s/q7vfoen9yo5ck05lgbq4c3ypwhdp1mnz]coinsGenerator.capx[/url]
  • korbaach This is very fantastic way.

    Thank you

    Why didn't you make a tutorial on this on Tutorial section ?

  • Hi korbaach

    I am again here with new question

    on above coin generator

    I want to save animation frame also

    for example

    in a complete shape i want to put some yellow coins some red some yellow etc. then Now what modification i have to do to get this result

  • luckyrawatlucky

    You can store coins of different colors in the same array, minimum changes are required.

    Instead of just 0 and 1, use: 0,1,2, etc.

    Where 0 means no coin, 1 is gold coin, 2 is red coin, and so on..

    Add a second frame to the coin sprite, don't forget to set animation speed to 0.

    Then change just one line in the event sheet:

    Result:

  • And similar changes in the CoinsEditor:

    Add another frame for the red coin, set animation speed to 0.

    Change this line in the event sheet:

  • yea..I intentionally delayed with the answer..because it is very easy to modify code to luckyrawatlucky needs..

    just hoped he would understand it.. and do it alone..

  • I keep wondering if C3 will be made to allow us to make editors like that.

  • oh Wow ! its amazing !

    I was thinking that i have to use z for it but its easy

    Now I have curiosity to know that can i do same for saving Angle, Opacity etc, Does i have to use "z" for saving its angle & opacity.

    we are saving "x" for x position, "y" for y position, and values for animation frame and what if we want more values to save like angle. Does we have to insert another Array ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can use Z coordinate for storing angle and opacity, but this becomes a bit difficult to comprehend.

    I think it might be easier to store string values in the array, instead of integer 0,1,2...

    Your array will look something like this:

    [

    ["2:90:100", "1:0:70", "", "", .......]

    Where "2:90:100" means frame=2, angle=90, opacity=100.

    You just need to parse the string to get these values.

  • I am trying here but i am not good in arrays, not getting any idea of doing this

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