How do I Resizing on Collision, Comparing size of 2 objects.

Get help using Construct 2

Post » Tue Mar 10, 2015 9:18 pm

Hello guys, I am totally new to programming its self, however I understand it fairly well, however I got some issues with finding certain ways / expressions to what I want to achieve. Hopefully I will get some help here.

So, what I want to do:

A) If player collides with another object, it should check wether the player is bigger or smaller than that object ( in actual pixel count )

B) If the player is bigger than the object, than the player should change size by 10% of the object size that it has collided with.

C) If the player is smaller that the object, than the player should decrease in size by 10% of the object size that it has collided with.

* The thing is, that my player will collide with lots of different shapes, and I really do not want to take just width / height in the account, I would like to take in the account the actual size of the object, I think that something like pixel counting ( after eliminating transparency ) would be best solution, if at all possible.

Thank you very much & please accept my apologies for my rather bad English.
B
3
Posts: 6
Reputation: 187

Post » Tue Mar 10, 2015 10:25 pm

What are you going to base the 10% on ? the number of pixels in your player vs the number in the other object? If so how will you alter it's size if not by using the height & width.

Counting pixels will be a relatively slow process if there are lots of objects or the game is fast moving. If you really want to do it you could check out the canvas plugin. This will give you a way of calculating the actual number of pixels which are anything other than transparent.
B
47
S
16
G
9
Posts: 1,097
Reputation: 11,180

Post » Tue Mar 10, 2015 10:55 pm

Thanx for a hint.

Could you please be little more descriptive about "a way of calculating the actual number of pixels", I am poking around,but I cant find the way :/
B
3
Posts: 6
Reputation: 187


Return to How do I....?

Who is online

Users browsing this forum: BackendFreak, Kitsune42k, Lukioks and 1 guest