Unnatural20's Forum Posts

  • Global a=0;

    Global b=0;

    Global NextBlock=1;

    on hit | System -> Set a= (array X of block hit)

    -------------System -> Set b= (array Y of block hit)

    System -> NextBlock = 1 | System -> NextBlock = 0

    ------------------------------------Array.setAtXY(a,b) to "0"

    (subevent) Inventory Value at (a,b-1) = "C" | System -> set NextBlock to 1

    -----------------------------------------------------------| System -> set b to b-1

    (subevent) Inventory Value at (a+1,b) = "C" | System -> set NextBlock to 1

    -----------------------------------------------------------| System -> set a to a+1

    (subevent) Inventory Value at (a,b+1) = "C" | System -> set NextBlock to 1

    -----------------------------------------------------------| System -> set b to b+1

    (subevent) Inventory Value at (a-1,b) = "C" | System -> set NextBlock to 1

    -----------------------------------------------------------| System -> set a to b-1

  • do not need a path. you need to read the data cell array and on the basis of these data, move the sprite

    word "path" means where sprite goes

    example

    where would sprite go in this picture case

  • What would it do if there were two paths it could take?

  • The problem I see is in Event 131, under ">Mouse -> On Left Button Clicked on ObjectsDisp"

    You have, "Inv -> Delete index Inv.IndexOf(ObjectsDisp.ItemGroup) from X axis."

    This can delete the intended object, , or it might instead remove another object with the same item group. However, you always *create* the right kind of object, so you could (as the demo stands) end up with two hoes or two hammers.

    My suggestion: Give ObjectsDisp another instance variable named "SlotNumber".

    Then, in refresh inventory, Inv -> For Each X element (Event 128 or so) add ObjectsDisp -> Set SlotNumber to Inv.CurX.

    Then, in place of what you had, Inv -> Delete index ObjectsDisp.SlotNumber

  • So many questions. Including your .capx would probably help!

  • I'm not seeing your problem? Once I re-implemented the frame fix and origin fix, things seem to work pretty well.

  • zatyka

    Great example! I would have headed towards some sort of tilemap based solution, but this is far more elegant and efficient.

    It is super elegant and very efficient!

    I added it to a .capx with just about 10 events, given that the existence of the objects and their overlap was already there.

    Now, though, I must decide; since my cameras can potentially rotate... do I prohibit rotation? Do I ignore their rotation, and simply estimate coverage? (if this algorithm finds a square rotated 45 degrees, for example, it will treat it as a square covering twice the volume.)

    Do I allow rotation up to a certain number of degrees?

  • This is really cool! But I have a question: in event 11, you set TestRectangleRight to (Xcoordinates.At(loopindex("X")))+(Xcoordinates.At(loopindex("X")+1)-Xcoordinates.At(loopindex("X")))

    Doesn't this always evaluate to the same as Xcoordinates.At(loopindex("X")+1)?

    Approximately the same expression appears for TestRectangleBottom.

  • Can you upload your current .capx?

  • Sorry, that should be Toolnames.At(Objects.AnimationFrame) I think

  • Hi! I'm Unnatural20. I heard about Construct 2 while working with a friend on the graphics for his game. He had a grand 'ol time with Construct 2, after GameMaker failed him again and again.

    He ran out of gameplay and level ideas and sputtered. But when *I* had a game idea, I figured Construct 2 would be the way to go.

  • Start by making an array, Toolnames.

    In System -> On Start of Layout

    Toolnames -> Push Back "Hoe" on X axis

    Toolnames -> Push Back "Shovel" on X axis

    ... "Hammer", etc,

    You then have an array full of tool names.

    Then in Toolstuff, you just need one Condition, instead of one for each tool:

    Objects -> ItemGroup = "Tools"

    But the action is,

    Objects -> Set Itemframe to Objects.AnimationFrame

    Objects -> Set Itemname to Toolnames.Objects.AnimationFrame

    In both cases, Objects.AnimationFrame will be treated by Construct 2 as just a number.

    So if the animationFrame was 2, it will set the ItemFrame to 2, and the Itemname to Toolnames object 2- which would be your hammer!

  • To reduce the object handling code, Have an array (here called, ObjectsArray) that's full of item names, in the same order as the items are in the animation. Then, under Miningstuff, it would go ItemGroup = Mining --> Set ItemFrame to Objects.AnimationFrame and Set ItemName ObjectsArray.Objects.AnimationFrame

    As for why the item isn't in the slot right; the crosshairs in the image editor lets you adjust where the object origin is. It should match up from item to item, but does not.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can the the difference between the two here; they need to match in order, at least with the current code.

  • Do you need the functionality of Nickname, Canvas, and Paster? Not having them means the .capx won't even open.

    If you do need them, could you maybe include a bigger screenshot? this one is Not Readable.