Disable behavior on single instance of an object

0 favourites
  • 4 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • 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!

  • 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))

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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 - dl.dropboxusercontent.com/u/143636437/examples%20for%20web/scroll%20to%202.capx

  • Ok I should have done a search first -

    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 ....)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)