R0J0hound's Forum Posts

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

  • The "for each element" condition doesn't set the loopindex. Instead use Array.CurX, Array.CurY or Array.CurZ.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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

  • So, your events were like this?

    keyboard: on down arrow pressed
    mainmenu_items: animation frame=0
    ---> mainmenu_items: set animation frame=1
    
    keyboard: on down arrow pressed
    mainmenu_items: animation frame=1
    ---> mainmenu_items: set animation frame=2
    
    keyboard: on down arrow pressed
    mainmenu_items: animation frame=2
    ---> mainmenu_items: set animation frame=0

    Adding the wait works well as you delay the frame from getting set right away so the 2nd and 3rd events won't be true and run. On a side note you should be able to do "wait 0" as it will just delay till the end of the event sheet.

    Another approach I like to take in a situation like this is to also use the modulus operator to simplify the logic. eg:

    keyboard: on down arrow pressed
    ---> mainmenu_items: set animation frame= (mainmenu_items.AnimationFrame+1)%3
    
    keyboard: on up arrow pressed
    ---> mainmenu_items: set animation frame= (3+mainmenu_items.AnimationFrame-1)%3
  • It's fairly simple to do but will take a little work. Basically all you do is add a sprite to the layout and give it the same behaviors that the Block object has. Then go to the event sheet and go one by one through all the events and change anything that says block to sprite. Then after that you can safely delete the block type from the project.

  • Edit* Something screams out as very wrong when you are better off downloading from the forums than the main page.

    I think it's along the same lines as C2's beta/stable releases. It seems to be pretty common practice with a lot of free software, and especially open source.

  • Niiccs

    My bet is the crash is caused by the "OR" condition. It often works fine until a layout restarts. The solution is to not use it at all in Construct Classic. Other than that I can't think of any other cause. If that doesn't fix it pm me the cap and I'd be happy to take a look.

  • Another alternative to a function is to use the system condition "pick all". So your event could look like this:

    spriteShot: On Colision with spriteEnemy

    system: pick all spriteEnemy

    ---> spriteEnemy Destroy

  • Instead of using "overlaps at offset" use an array to store the grid for a quick lookup. So if your blocks are 32x32 and have a top/left hotspot, and your layout is 640x480 then your array size will be 640/32 x 480/32 or 20x15. Then fill your array with 0 for empty and 1 for filled if a block is there. Your initial event will look like this:

    Start of layout

    for each block

    --- set array at int(block.x/32), int(block.y/32) to 1

    Then later on for the simple case of instantly growing grass you can see if it's empty above the block like this:

    for each block

    array at int(block.x/32), int(block.y/32)-1 = 0

    --- grow grass

    Anyway regardless, I still think the second part of my last post will work for the situation of the grass growing from the left to right, one per time frame.

    I whipped up an example and I think I found an alternate method that would work better. Basically have the grass grow next to another grass every 0.5 second, but on every 2 seconds make a random sprite grow grass instead. That would solve the issue of needing an initial grass to grow from.

    https://dl.dropboxusercontent.com/u/5426011/examples19/grass%20grow%202.capx