[SOLVED] 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 Fri Sep 16, 2016 6:50 am, edited 1 time in total.
Image
B
64
S
39
G
42
Posts: 630
Reputation: 30,553

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,459

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
Image
B
64
S
23
G
7
Posts: 1,482
Reputation: 10,825

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
64
S
39
G
42
Posts: 630
Reputation: 30,553

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
Image
B
64
S
23
G
7
Posts: 1,482
Reputation: 10,825

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
64
S
39
G
42
Posts: 630
Reputation: 30,553


Return to How do I....?

Who is online

Users browsing this forum: ALLMarkMade, Bro7hers, ezgaming420, marcinkowski, Yahoo [Bot] and 2 guests