countofquad's Recent Forum Activity

  • Ashley, thanks for clearing that up.

    The problem with potentially using on OnCreated trigger is that I already have a OnCreated Family trigger that handles normal creation of Object A and Object B (both of which belong to this family). When one of those objects is created in a subevent, I need to set up specific variables up in Object A and Object B to certain values.

    Okay, I have an possible solution. I could create some global variables, such as:

    CreatedBy, Var1_Value, Var2_Value

    Then in code:

    Line 01 : EVENT 1

    Line 02 : -- Sub Event A

    Line 03 : -- -- CreatedBy = "SubEventA";

    Line 04 : -- -- Var1_Value = "ObjA_CustomValue1";

    Line 05 : -- -- Var2_Value = "ObjA_CustomValue2";

    Line 06 : -- -- Create Object A

    Line 07 : -- -- -- Do some stuff

    Line 08 : -- -- Var1_Value = "ObjB_CustomValue1";

    Line 09 : -- -- Var2_Value = "ObjB_CustomValue2";

    Line 10 : -- -- Create Object B

    Line 11 : -- -- -- Do some stuff

    Line 12 : -- -- CreatedBy = "";

    Line 100: On Family Created Trigger

    Line 101: -- if CreatedBy === 'SubEventA'

    Line 102: -- -- Family.Var1 == Var1_Value

    Line 103: -- -- Family.Var2 == Var2_Value

    Line 104: -- else

    Line 105: -- -- // Normal initialization for Family properties

    Does that seem like a good solution?

  • Ashley:

    Hmm, I think maybe an example would help clarify my question. My actual code is more complex than this, so I'm simplifying for purposes of this post.

    Let's say you had the following code:

    Line 1: EVENT 1

    Line 2: -- Sub Event A

    Line 3: -- -- Create Object A

    Line 4: -- -- Do some stuff

    Line 5: -- -- Create Object B

    Line 6: -- -- Do some stuff

    [snip]

    Line 100-105: On Created Object A Event Code

    Line 106-111: On Created Object B Event Code

    What does the actual execution order look like for this?

    Does it go:

    Line 1

    Line 2

    Line 3 (Create Object A)

    Line 100-105: (On created Object A Trigger event code)

    Line 4

    Line 5 (Create Object B)

    Line 106-111: (On created Object B Trigger event code)

    Line 6

    I read this in the manual concerning triggers:

    "Rather than running once per tick, this event simply runs (or "fires") upon something actually happening. In this case, the event runs when the user hits the Spacebar key on the keyboard. It is never checked any other time. Since triggers run upon an event happening, they aren't checked in top-to-bottom order like other events. This means the ordering of triggers relative to other events is not important (except relative to other triggers of the same type, since triggers still fire top-to-bottom)."

    The reason that I'm concerned is what would happen if Object A's OnCreated code contained a Spawn Sprite statement for SpriteC. Would SpriteC be in the SOL at the point of Line 4?

    Thanks,

    -- countofquad

  • Ashley,

    Thanks, I'm aware of that but the problem is that we're not guaranteed code order unless I purposely put the Event On Creation code at the bottom of the event sheet otherwise I'd have to wait for the game-loop to repeat.

    Additionally, I have lots of other previously picked SOL lists for other objects which happens in this event branch code, by the way it gets to the On Event Creation which is a top-most event, all of my SOL lists are no longer guaranteed to be the same.

  • <img src="https://dl.dropbox.com/u/12667027/Construct%202/FamilyBug.png" border="0" />

    I've just created a new object called RainCloud. RainCloud sprite belongs to the CloudFamily list, but this second command which changes the opacity doesn't seem to be working for the object. Shouldn't a Family SOL list refer to the last created object which belongs to that Family? If I change the command from CloudFamily -> SetOpacity to RainCloud -> SetOpacity it works.

    This seems to be unrelated to the other SOL issue concerning sibling events not being able to pick sprites created in prior events on the same chain.

    I have tons of commands in branches which need to be able to refer to the last created instance object of a family. I don't want to have to create duplicate code that acts on each sprite type belonging to a family.

    Thanks for any advice,

    Shaun

  • <img src="https://dl.dropbox.com/u/12667027/Construct%202/Picking%20Bug.png" border="0" />

    Ashley: That's a relief then. But what about this?

    The highlighted command seems to fail, even though both Cloud and RainCloud belong to CloudFamily, I even changed it to be explicitly Cloud->SetOpacity and it still failed.

    I would have expected CloudFamily SOL to be the last created instance of a sprite belonging to that family.

    If this is intentional, that's really unfortunate, it seems like I'm going to have to setup lots of duplicate code in each branch.

    Please advise,

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ashley

    Wait, now I'm confused. Does this mean that the subsequent set variable call on ObjA is not going to correctly pick the newly spawned ObjA?

    Event 1

    -- Spawn ObjA

    -- Set ObjA.MyVal = 1

    What about this one:

    Event 1

    -- Spawn ObjA (Instance1)

    -- Spawn ObjA (Instance2)

    -- Event 2

    -- -- Use ObjA

    I'm not doing explicit PICK calls, I'm just trying to use the current SOL. On Event 2, I would expect ObjA SOL collection to only contain Instance2 since it was the latest one. Is that correct?

    You mentioned that this is how it worked on Construct Classic but I really feel like this is an architecture issue that's going to happen again and again. Combined with the fact that objects of the same type cannot spawn another instance of themselves and I feel like conditional logic is going to get so messy from having to workaround these problems.

    Thanks,

    countofquad

  • I put three 64x64 boxes, this box sprite has the physics behavior, down on a single layout, they are widely spread apart, such that there is no overlap between any of the boxes, and yet when I start the simulation, they immediately "repel" each other, as if there is some gravitational mass that I'm missing.

    Changing density seems to have no effect. What the heck is going on?

    thanks!

  • I think one problem is that when code consistency changes, because of the inherent design system in place, there is no easy way to go back and change things quickly. There is no concept of "search & replace"/"refactoring" or anything that you could do easily in a scripting programming environment.

  • Ashley (hope he can weigh in on this issue)

    Alspal, that is what I've been doing. Basically, I draw my entire level map in Photoshop which is very large, about 1000 by 10000 pixels, set my Construct window size to about 640x480 which results about 15 screenfuls in the game, then I split my single huge photoshop map into 10 png files of 1000 pixels by 1000 pixels so something like this:

    level_p1.png 1000x1000

    level_p2.png 1000x1000

    ...

    These png files are imported as tiled backgrounds. My reasoning for this is that even though I'm not taking advantage of the tiling functionality, I recall reading somewhere that tiled background objects have less "built-in maintenance/logic" as opposed to full sprite objects.

    Then using Scirra Construct 2 View Grid I lock the grid size, then drag each image p1 - p10 into the game view adjacent to each other. After this, I use generically alpha transparent shape sprite objects(squares, 45 degree triangles, etc) which have collision behavior on a separate layer in the appropriate places where the terrain should be solid. These collision objects are visual in-editor, but visibility is turned off in-game.

    Of course, anything in the game, such as enemies, player, etc are separate sprite objects. This approach seems to work, but I want to know if it is a good idea in terms of performance/optimization.

    I need a professional definitive expert opinion about this approach with respect to Construct 2. Is it a good idea? Why or why not? Will I run into scalability issues depending on the platform and or scope of the game? I think many people using Construct 2 would like an answer about this.

  • I've tinkered with the demo for Construct, and although I really like it, having to click so much to achieve events that you could type out really quickly (especially with intellisense support) with a built-in script editor would be really handy. I think it wouldn't be too difficult to allow the developer to use either advanced script mode or drag and drop for beginners. Plus I don't know, I think it's a lot easier for readability to see a script to understand the logic flow of a complex program.

    Game Maker does a really good job with providing support for both, and includes support for calling functions by string name and also instantiate objects by string name, its really great for creating game editors and such.

countofquad's avatar

countofquad

Member since 31 Jul, 2012

None one is following countofquad yet!

Trophy Case

  • 12-Year Club
  • Email Verified

Progress

13/44
How to earn trophies