How to arrange sprite on Grid

Get help using Construct 2

Post » Wed Jun 07, 2017 5:12 am

on Layout I have Sprite which i cloned 36 times
Now i want to arrange them with events and it should customize grid like
if i click on button (Grid 6) arrange them on 6x6
if i click on button (Grid 4) arrange them on 4x4 remaining will go hide

How we could do this ??
Image
B
64
S
39
G
45
Posts: 651
Reputation: 32,214

Post » Fri Jun 09, 2017 10:07 am

bump
Image
B
64
S
39
G
45
Posts: 651
Reputation: 32,214

Post » Fri Jun 09, 2017 2:35 pm

It's that what you're looking for?
https://drive.google.com/uc?export=down ... lNxOVN5UWM

Hope that works. Feel free to ask if something is unclear.
B
24
S
3
G
1
Posts: 451
Reputation: 2,165

Post » Fri Jun 09, 2017 4:53 pm

yes this i want
but a problem is
i do not want to create
i have cloned several times like 64 times
when i click button 6x6 then 36 will be alligned from index id 0 to 35 and other will go delete
and same for 8x8
==========
one another thing i wamt to ask if you know
in spritefont >property
we have option character width and character height
i want to change it from event sheet
if their any way of doing this??
Image
B
64
S
39
G
45
Posts: 651
Reputation: 32,214

Post » Fri Jun 09, 2017 9:04 pm

I made another example with 36 instances of one sprite. If you have 36 different sprites or other objects not instances you have to put them in a family. That should work also. I didn't test that.
You can delete the sprites if you put it to a position outside the layout or destroy them.

https://drive.google.com/uc?export=down ... WU5bVhCaHM

The character height and width in the spritefont properties is to define the spritefont itself, not to change the size. If its that what you want you have to use scale.
I don't think it's possible to change the height and width properties with an event. This properties are the real height and width of the spritefont you need that to display it. You can't load a spritefont in an event, so it's not necessary to change this properties with an event.
B
24
S
3
G
1
Posts: 451
Reputation: 2,165

Post » Fri Jun 09, 2017 11:22 pm

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

Stepping in with an example
and an argument to stay away from cloning (watch loadtime and memory).
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sat Jun 10, 2017 12:02 am

@Asmodean and @99instance2Go
i like both example
i was asking for spritefont changing character width & height because
i have made a tutorial on
How to make Photo Slide Puzzle Game in just 2 events
and i have used spritefont for photo slices
Now i want to extend that tutorial with making option of select grids
grid section is complete
but remaining part is spritefont
i was wishing when grid is 6 then wants to enlarge chr height & width
but is their any alternative way??
Image
B
64
S
39
G
45
Posts: 651
Reputation: 32,214

Post » Sat Jun 10, 2017 7:12 am

i was wishing when grid is 6 then wants to enlarge chr height & width
but is their any alternative way??


I don't see any way to do it direct. The not so elegant way would be to make several Spritefont-Grids with different grid sizes and make the one visible you want.
B
24
S
3
G
1
Posts: 451
Reputation: 2,165

Post » Sat Jun 10, 2017 11:33 pm

Just use Paster from @R0J0hound ?

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

Tiles are drag-able.
Change the values 4 the global vars in the event sheet
(once again to lazy to make buttons)

I have totally no idea for any other alternative.
Unless someone modifies the plugins for SpriteFont or Tilemap, making the cell sizes addressable in actions.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sun Jun 11, 2017 12:03 am

B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Next

Return to How do I....?

Who is online

Users browsing this forum: yiuyiu6666 and 25 guests