Add attribute not working properly?

This forum is currently in read-only mode.
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • I've been having trouble with the "add attribute" action lately, so to find the cause I used it in an extremely simple event and it just... isn't doing it right. I dunno what else to say. The event just says:

    Item PV Equal to 2: Add attribute "Solid"

    Nothing more than that. For some reason, sometimes it WILL make it solid... after waiting about ten seconds or so. I tried debug mode and the PV is working fine, so it isn't that, and there's no other event in the entire game that might add or remove attributes to Item. For testing purposes, I added another PV called "Solid" that gets set to 1 after the add attribute action, and even that works like it should. Even so, there's a huge delay in making it solid or it doesn't happen at all.

    Is this a bug?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you don't need it to colide with anything before it is set to solid you could do this

    Set it the solid in the layout editor

    Start of layout set it's collision mode to none

    When PV=2 set the collision mode to per pixel/box etc

    Not sure about how you are doing it at the moment, have not tried to do anything with adding atributes.

    also have a look at if this would work

    Set the atribute to solid in the layout editor

    Start of layout change the atribute

    PV=2 set the atribute to solid

    Just incase there was some issue with assigning atributes at run time. Who knows, right.

    Now Newt will reply underneath this and have all the information and the perfect solution for you!

  • Its true, I'm on here way too much.

    Anyway Steven's suggestion is usually what I would do instead of trying to add the attribute.

    The way its acting tho does suggest that perhaps your comparing an integer to a float.

    IE 2 does not equal 2.1, or 1.9.

  • The float thing occurred to me, but like I mentioned in the original post, for testing purposes I changed it to:

    Item PV Equal to 2:

    • Add attribute "Solid"
    • Set pv "Solid" to 1

    And "Solid" is indeed set to 1 when it's supposed to, which wouldn't happen if the comparison wasn't working.

    Anyway, your suggestion... well, I don't think it can work for what I'm doing. I wanted to keep the description vague, but oh well, here goes.

    The item is a hammer that Mario can use in my game. While carrying it around, it's part of his sprite rather than an actual object, but when you get hit by an enemy and shrink to small Mario, it creates a hammer object and drops it to the ground. Small Mario isn't strong enough to use the hammer, so when Mario's health is 1 (meaning he's small), the hammer should be solid. When his health is 2 (Super Mario, and thus strong enough to pick the hammer up again), it shouldn't be solid so he can overlap it and pick it up. I can't use any start of layout things because the hammer is created during run-time, so the only other thing I can think of is adding and removing the solid attribute.

  • You could always loose the attribute, and just use a state machine with object is overlapping at offset.

  • "State machine"? Never heard that one before.

  • You've already used them.

    Item PV Equal to 2: Add attribute "Solid" is a state machine.

    So if hp > 1 ... hammer time

    hp < 2 ... cant touch this

  • Ohh alright. I had no idea that's what it was called.

    So if hp > 1 ... hammer time

    hp < 2 ... cant touch this

    Ahah, you're too late! I already made that joke in the comments of my project.

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