R0J0hound's Recent Forum Activity

  • I forgot to search for existing bugs and was informed about this existing one:

    http://www.scirra.com/forum/r116-changing-layout-and-on-destroyed_topic62431_post383279.html

  • Link to .capx file (required!):

    dl.dropboxusercontent.com/u/5426011/bug/bug_negative_objectcount.capx

    Steps to reproduce:

    1. Create a project and add a second layer.

    2. Add a sprite and a particle object to layer 1.

    3. Make the particle object "one shot" and make it's timeout 0.5.

    4. Add two events:

    every 1 second -> got layout 1

    Sprite: on destroyed -> Sprite spawn particles on layer 0

    5. Run in debugger.

    Observed result:

    After the capx restarts the layout about 4 times the objectcount will be negative.

    Expected result:

    It should never go below 0.

    A few more observations about the bug

    It only occurs if the sprite is not on layer 0.

    Browsers affected:

    Chrome: untested

    Firefox: yes

    Internet Explorer: untested

    Operating system & service pack: Vista sp2

    Construct 2 version: 149

  • Aurel

    If you're able to make the object count negative then I'd most certainly say it's a bug that should be fixed. I can't find a way to reproduce it, but if you can make a minimal capx or make your capx as minimal as possible and report it to the bugs forums that would be good.

    While BluePhaze's advise is true in many programming languages, for C2 it's not. It's designed to make it completely safe to still access objects directly after they are destroyed and once they are completely destroyed you can no longer access them.

    ramones

    That seems to be some odd behavior there, so I filed a bug. I would expect no object to survive a layout change unless it were global, regardless what event it were created from.

  • Link to .capx file (required!):

    dl.dropboxusercontent.com/u/5426011/bug/bug_creation_from_destructor.capx

    Steps to reproduce:

    1. Add a sprite and add an "on destroyed" event.

    2. In that event have another object get created.

    3. Then make an event to change or restart the layout.

    Observed result:

    When the layout changes the object created in the "on destroyed" event still exists.

    Expected result:

    I would expect no objects to survive a layout change unless they were global.

    Browsers affected:

    Chrome: untested

    Firefox: yes

    Internet Explorer: untested

    Operating system & service pack: Vista sp2

    Construct 2 version: 149

  • Yes it's possible. First off just design your pages in the layout editor. With a window size of 640x480 and ten pages you'll want your layout size to be 640*10x480 or 6400x480 and just position all your text and whatnot on the layout keeping in mind that every 640 pixels is a new page. Next here is a way to setup your events to scroll around using a click drag.

    global variable oldx = 0
    
    On left mouse clicked
    ---> set oldx to Mouse.AbsoluteX
    
    left mouse button is down
    ---> Set scroll X to scrollx+oldx-Mouse.AbsoluteX
    ---> set oldx to Mouse.AbsoluteX
    

    All that's left is to move to the closest screen when not dragging. This can be done with one more event like this:

    else
    ---> Set scroll X to lerp(scrollx, round((scrollx-320)/640)*640+320, 10*dt)

    Where:

    640 is the window width

    320 is half the window width

    10 is basically a speed

  • Sargas

    In event 15 it has the condition "hex owner=0". This is where the seeming priority comes from. You can disable that condition and it will spread correctly, but base2 will overwrite areas base has and vise-versa. One idea for a remedy for that would be to add a Boolean variable to hex and call it say "owned" and replace that condition in event 15 with a "[negated] hex is owned". So with that it will spread correctly but we also need to set "owned" to true eventually so we do that by adding a sub-event to event 4:

    system: Pick all hex

    hex: owner != 0

    ---> hex: set owned to true

  • Kyatric

    Actually all my plugins should work fine on any exported platform as they only use features that c2 already uses internally.

    Plugins in general should work on all exports, although exports like cacoonjs has no support for window controls like buttons or dropdown boxes. And things like file system access is only available on node webkit exports.

  • You can do it by selecting events in the event sheet, right clicking and selecting "replace object". With it you can replace an object with another of the same plugin type.

  • Hi,

    I like the event setup in your first version. So I edited that slightly to get it working.

    https://dl.dropboxusercontent.com/u/5426011/fixed/sargas_hexzones.capx

    All I added was parameters for the functions. Functions don't keep track of what was picked when it's called, it only knows what was passed to it.

  • I imagine restarting C2 would fix it, but as something less drastic have you tried closing that layout tab and then re-opening it?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The "for each element" condition doesn't set the loopindex. Instead use Array.CurX, Array.CurY or Array.CurZ.

  • Well, if for instance you only wanted dirt after the 5th row, then add a system compare condition to the bottom of event 2:

    Tile_Array.CurY > 5