Disable behavior on single instance of an object

Get help using Construct 2

Post » Mon Jan 20, 2014 12:03 am

Hello!

For my first project, I'm working on an online MMO-style game. I already have multiple users able to log in, run around and chat with each other just fine.

My question is this: I have a scrollTo behavior on my "Player" object. Each player who logs in creates a new "Player" object. I do not my the players that are not 'Me' to have the scrollTo behavior activated. However, when I disable the behavior on one instance, it disables the behavior on all players so that the view never scrolls. I disable the behavior in the same event that assigns character name, etc. so I know it should only be for that one player.

I read the manual and it states the following:

All instances of an object type use its behaviors. You cannot add a behavior to only some of the instances - they all use the behavior - although you may be able to enable or disable the behavior for individual instances.

I cannot find any documentation on HOW you disable the behavior on a single instance.

Help!
B
3
Posts: 1
Reputation: 177

Post » Mon Jan 20, 2014 9:39 am

Not quite the answer you are after - but here is one way to scroll to one instance

Right click makes more players. scroll to only works on green (main) player.

Choose new main player with left click

three different scroll in capx (events 7 ,8 and 9)

scroll to instance

edit - I have left the "camera sprite" visible - obviously you would not want this in your game... (also make the camera sprite smaller might help with frame rate/cpu usage (slightly))RamPackWobble2014-01-20 10:05:11
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Mon Jan 20, 2014 9:53 am

After another look I am unable to disable scroll to on one instance and enable on another - I don't know if this is a bug or (more likely) just lack of knowledge on my behalf. My method will disable other behaviours (eg flash - well turn off not disable)

Here is what I thought would work - https://dl.dropboxusercontent.com/u/143636437/examples%20for%20web/scroll%20to%202.capx

August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Mon Jan 20, 2014 10:00 am

Ok I should have done a search first -

http://www.scirra.com/forum/disable-scroll-to_topic78174.html

so I suggest you stick with one of the three methods in my first post.

Good luck

You could also pin the camera to your main player (which on choosing a new player would require unpinning, moving to new main player and pinning to him - but this would remove the need to have a every tick move camera to main player ....)RamPackWobble2014-01-20 10:05:47
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests