N00B questions for a better solution

Get help using Construct 2

Post » Sun Mar 13, 2016 1:22 pm

Hi,
I'm not happy with my solutions - maybe you can help me out to find a better one

1. if objPlayer is overlapping with 2 objEnemies then xxx
Tried different ways with UID 1 and 2 and overlapping objPlayer but solved it right now with variables I set

2. when dragging an object - it should get stopped when hitting a wall
right now my workaround is to set the movingObject back where it came from (on drop)

3. count objects
Is there a way to if x objEnemies are on screen then…
my solution right now is to set variables when objEnemies is destroyed/created

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707

Post » Sun Mar 13, 2016 2:21 pm

1. "is overlapping" condition grabs some SOL. So you can simply check the SOL count. If it's equal to 2 then do something.

2. On collision with wall just run "drop" action from Drag&drop behaviour.

3. family.count returns the current number of objects.
ImageImageImage
B
27
S
16
G
79
Posts: 1,013
Reputation: 44,245

Post » Mon Mar 14, 2016 11:55 am

THX @BackendFreak
you solved 1 and 3 (where I am a little embarrassed that I totally forgot that I can use families - but I guessed it would be easy - that's why the n00b title)

with your SOL (select object list) I am not sure if I took the right path, but I used objEnemy.pickedcount (still didn't figure out how to just use a condition)

2. unsolved drag and drop
If you drag the objPlayer to fast, then the drop on collision or overlapping drops the object into the objWall

So I attached a capx where I use a follow every tick as long as in a certain area (this comes pretty close to what I want)
The perfect solution would be that the dragged object gets repelled from objWalls and objEnemies (that's why I left a gap in the wall).

The only solution I could think of is so complex I didn't even try if it would work, because I am pretty sure that there is a much nicer way to do it.
So my solution would involve checking the drag angle and when objectPlayer hits an object it gets moved -180 degrees against the drag angle as long as it is overlapping (but I also should have to check where the wall is, so i only use X or Y).

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

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707


Return to How do I....?

Who is online

Users browsing this forum: RalleRoyal and 28 guests