How to Appear coins in a spl pattern in FlyingAlong

Get help using Construct 2

Post » Sat Sep 03, 2016 5:25 am

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
Image
Last edited by luckyrawatlucky on Wed Sep 20, 2017 9:49 am, edited 2 times in total.
Image
B
72
S
42
G
48
Posts: 688
Reputation: 34,392

Post » Sat Sep 03, 2016 11:54 am

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.
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,469

Post » Sat Sep 03, 2016 6:45 pm

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..)
B
11
S
6
G
15
Posts: 256
Reputation: 9,207

Post » Sat Sep 03, 2016 7:43 pm

..or you can fill array with 0&1

array2Coins.capx


Image
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Mon Sep 05, 2016 4:51 am

@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 ??
Image
B
72
S
42
G
48
Posts: 688
Reputation: 34,392

Post » Tue Sep 06, 2016 12:30 pm

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

Coin 32x32 on 32x32 grid

Image

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

Code: Select all
"{""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]]]}"


to get this array code you need just one smaller sprite
Image
and some simple code to check each position for coin
Image

coinsEditor.capx

that was the first part..now you can open pattern.json file in text editor and copy code to your capx

coinsGenerator.capx
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Wed Sep 07, 2016 6:05 am

@korbaach This is very fantastic way.
Thank you
Why didn't you make a tutorial on this on Tutorial section ?
Image
B
72
S
42
G
48
Posts: 688
Reputation: 34,392

Post » Wed Sep 20, 2017 9:50 am

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
Image
B
72
S
42
G
48
Posts: 688
Reputation: 34,392

Post » Wed Sep 20, 2017 2:07 pm

@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:
Image

Result:
Image
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :)
B
17
S
9
G
71
Posts: 1,070
Reputation: 38,703

Post » Wed Sep 20, 2017 2:14 pm

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:
Image
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :)
B
17
S
9
G
71
Posts: 1,070
Reputation: 38,703

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 29 guests