[Bug?] Funny sprite behavior?

This forum is currently in read-only mode.
From the Asset Store
Funny Game
$5.99 USD
Funny Game - Funny melody for funny games! With xylophone, guitar and banjo.
  • Okay, I have attached a demo, which uses contained sprites and hashtables. By right clicking them, the hashtable value is incremented by one.

    At 1 click the sprite turns green, next click it reverts to yellow. At 5 clicks it is destroyed.

    Now, click around a bit and you might notice a funny behavior... Like, sprites start rebelling and changing color when they should not or even get destroyed en masse.

    What gives? Is it a bug? If so, I'd like to pinpoint it down before submitting a report. If it is just sloppy programming on my part, I'd like to have the flaw pointed out.

    Thanks!

  • No I don't think it's a bug.

    Just put the Sprite in the event sheet where you have the family green now and it should work.

    The hashtable is in a container with the sprite, so it won't work the way you want it to when you're using the family this way.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I see, makes sense now. I need to clear this up (among other things) before I attempt a real project, so I am making weird stuff like this to see how it works.

    If I got it right, if I want to change a specific sprite, I should pick it singularly instead of the family, but where I need to address a number of sprites, I should use a family instead?

  • If I got it right, if I want to change a specific sprite, I should pick it singularly instead of the family, but where I need to address a number of sprites, I should use a family instead?

    Not necessarily. Just because you have Sprite1 and Sprite2 in the Foo Family doesn't mean you have to pick Sprite1 by the family, nor does it mean you have to pick Sprite1 specifically in order to exclude Sprite2.

    For example, Sprite1 and Sprite2 are both in the Foo Family. All Sprite1's have the value '1' in their 'myNum' variable, and all Sprite2's have '2' in their 'myNum' variable. You could pick all Sprite1's like so, if you wanted to:

    + Foo.Value('myNum') is equal to 1
      -> Do stuff to Foo
    [/code:2n03pgje]
    
    It all depends on what you need Construct to do.
  • But what if you store values externally, say, from a hashtable, which is in a container with the sprite? Would the proper sprites be picked up by checking for hashtable key value?

    As you can see, I used exactly that in the above example and it behaved funny if I picked families by contained hashtable values.

    I want to use hashtable as I will need a dynamic table of variables, while there can be only a fixed number of PVs. Well, I could put numerous values into PVs as concatenated strings, but that'd make things unnecessarily complex (i.e. using Find() to locate the exact string in PV for each object would take more CPU time than just reading hashtable value).

    Oh gee, am I complicating too much? I just want a sprite or some sort of object that represents a RPG character/NPC/enemy with lots of variables of varying amount... the system has to be very robust, if I get bugs like my huge male barbarian suddenly becomes a female gnome witch... well... that'd be fun, actually.

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