codah's Recent Forum Activity

  • >

    >

    > I can see issues with this. How would you know if you were inadvertently accessing a behaviour that didn't exist?

    >

    Like I said, it would simply ignore it. Nothing would happen if it doesn't exist. You should know how your program works, so running into this issue wouldn't be an issue if you're aware of what things should be doing.

    .

    That's why I said inadvertently. That would be a very frustrating class of bug.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There's a simple work-around that I use sometimes. If you want to identify a sprite from a picked family then add a variable to the family to allow you to identify the sprite that has the behaviour you want to change. Then, using the Family.UID, the instance of that particular sprite can be picked (or instance of other family, if applicable). See the attached file for a super-simple demo. Hope this helps...

    I guess this is exactly what the OP is trying to avoid

    One thing that might help is by allowing a Family to belong in another Family, and aggregate the behaviours across all contained Families. This is something I've wanted a few times.

  • What I would want, or what I think would suffice:

    Families collect all behaviors from each object in the family, and provides access to these behaviors in the event sheets, but if the behavior is used, and the instance doesn't have that behavior, then that it is ignored.

    Seems like a simple thing to implement?

    I can see issues with this. How would you know if you were inadvertently accessing a behaviour that didn't exist? Could take a bit of debugging. I can just see it getting out of hand, and also breaking the tenet of 'simplicity' for C2.

    I'm curious what kind of workaround you're using at the moment. I would think something with the 'nickname' plugin would work.

  • Okay.

    Well, families group objects together.

    Objects in a family can have different behaviors from each other.

    Referencing a group allows you to use less events to pick out objects (saves you from having to create events for each object).

    When you pick out an object this way and need to perform actions based upon their behavior, then you simply can't do it without extraneous steps that make the events crowded and difficult to change later.

    Doing this defeats the whole point of Families.

    I guess there are logical reasons for their behaviour. A Family is like a base class in OO languages. When using a Family you're saying, I want to treat these types of objects as a 'new' XYZ type. You effectively lose the object type information at that point. To get that information back (in order to access their behaviours) you would need something like an OO 'cast' which retrieves the type information. This is even frowned upon in some OO circles. I disagree it defeats the whole purpose of Families. It cuts down on many identical events as you know. And yes I know C2 is not OO but it's an analogy.

  • Best option: don't start from scratch, start from a template/sample (File menu)

    Next best option: look in the tutorial section and read lots.

    Otherwise try this:

    Run C2.

    Choose menu File/New

    Choose "New empty project" (Enter)

    Double click anywhere

    Double click "Sprite"

    Click the white area inside the dashed lines

    Click inside the square in the window that appears (it should fill with a colour)

    Close the Edit image window

    Click Behaviors link under Properties (left of screen)

    Click "+"

    Double click "Bullet"

    Close Sprite:Behaviors window

    Click on the white area

    Click Project Properties "View" link under Properties

    Next to Preview browser, choose "Node-Webkit"

    Click "Play" (Run) button in tool bar

    You should see a window open and a green square move across the screen.

    Congratulations, your first 'game'.

  • No it's not possible. TBH it doesn't make sense to me to be able to do that.

  • Another method. Hope it helps.

  • Hi hope this helps.

  • I see, I think posting your capx would probably be the quickest way to solve the issue.

  • [quote:3rui75fx]random(x)

    Generate a random float from 0 to x, not including x.

    Seems to work as documented?

  • thanks for the tips

  • how can add this variable? / Which is the instance variable for the toggle boolean?

    Construct 2 missage: Instance Variable--> <none - add an instance variable first>

    Search "Variables" in the manual. Fully read and understand the first 5 hits. You will have greater challenges than this in making any game.

codah's avatar

codah

Member since 30 May, 2014

Twitter
codah has 1 followers

Trophy Case

  • 10-Year Club
  • Email Verified

Progress

11/44
How to earn trophies