How do I count each sprite width

Get help using Construct 2

Post » Mon Apr 24, 2017 9:21 am

Here's an example using a function. In the example I call the function at the start and on any mouse click (the mouse click also randomises the widths of the sprites to simulate the sprite widths changing during runtime) but you can call it whenever you need to in your project:

https://www.dropbox.com/s/zel61966va8ym ... .capx?dl=0
B
20
S
8
G
3
Posts: 458
Reputation: 4,055

Post » Mon Apr 24, 2017 8:32 pm

Message: maxwell88 can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
mekonbekon wrote:Here's an example using a function. In the example I call the function at the start and on any mouse click (the mouse click also randomises the widths of the sprites to simulate the sprite widths changing during runtime) but you can call it whenever you need to in your project:

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



good work :)
B
10
S
2
Posts: 40
Reputation: 711

Post » Tue Apr 25, 2017 4:38 pm

mekonbekon wrote:Here's an example using a function. In the example I call the function at the start and on any mouse click (the mouse click also randomises the widths of the sprites to simulate the sprite widths changing during runtime) but you can call it whenever you need to in your project:

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


Hi, i download your example and im wondering how add posibility to count spawned and stretched new sprites.


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

can you fix the problem?

i dont know why stretched lines after drop getting smaller
B
25
S
8
Posts: 215
Reputation: 2,173

Post » Tue Apr 25, 2017 5:43 pm

@IGDev Hi there, the reason your lines widths are changing is because you haven't disabled/deleted event 8, which randomises the the width of any sprite in the "sprites" family; I put that event in to demonstrate how the totalwidth value updates when the widths change - you don't need it.
B
20
S
8
G
3
Posts: 458
Reputation: 4,055

Post » Tue Apr 25, 2017 5:52 pm

@IGDev Also in your example it looks like you have a bug where clicking on the same sprite1 will generate additional lines - or is this intended? If you explain the required behaviour I can have a go at patching it up.
B
20
S
8
G
3
Posts: 458
Reputation: 4,055

Post » Wed Apr 26, 2017 10:22 am

mekonbekon wrote:@IGDev Also in your example it looks like you have a bug where clicking on the same sprite1 will generate additional lines - or is this intended? If you explain the required behaviour I can have a go at patching it up.



yes line must be created only on sprite1 surface and end on second sprite1

line should 'connect'
B
25
S
8
Posts: 215
Reputation: 2,173

Previous

Return to How do I....?

Who is online

Users browsing this forum: Exabot [Bot], Kin, ratboy3, tinhofiel, totoe and 39 guests