kittiewan's Forum Posts

  • The easiest way to handle this is to use the names of the sprites in the last event:

    Sprite is overlapping Sprite2 -> Sprite2 destroy

    (You don't need the test to see if the player variables are equal.)

    Was there something more you were trying to achieve?

    That is, is there some reason you need to do this with families that you didn't mention?

  • Probability of any one of n equally likely outcomes is 1/n. So if there are 2 choices, 1/2 =.5 or 50% for either choice.

    4 choices -- 1/4=.25 or 25% for any one of the 4 choices

    3 choices -- 1/3=.333 or 33.3% for any one of the 3 choices.

    As far as the upper limit not being included in the random, I think it is kind of normal. For example, if you look at the RAND function in Excel, it generates a number between 0 and 1, and then you can use that to generate a number between a and b using the formula

    RAND()*((b-a)+a)

    but that won't actually ever generate b. So maybe a formula like that was used to generate Random() in C2.

  • Thanks!

  • With IE, Chrome, Firefox and Safari all running at the same time, still only Safari dropped below mid 30's to mid 20's. IE and Chrome steady in 60's. Firefox was most erratic, sometimes swinging between 1 and 90 before I launched Safari then settling in mid 30/40 range.

  • I was going to say definitely subfolders, but do you mean sort of like a spreadsheet?

    This image shows the subfolders which you can collapse and expand in the project panel. But I guess it isn't what you were looking for.

    <img src="http://dl.dropbox.com/u/57899112/subfolders.PNG" border="0" />

    As far as subfolders go, it would be nice if you could:

    1) click on subfolder name to select all of the instances of the objects in the folder.

    2) drag and drop the subfolder to the layout to create an instance of each object in the subfolder.

    But better BY FAR would be hierarchical grouped objects. You could do so much with them!

  • I dont understand why youd want to move between layers at all. If a layer is over the main play layer then that layer should be considered to be a "not much of anything is higher into the 'sky' than this" the exception being sky/clouds etc.

    You're right that there is no requirement to change layers. The issue is one of performance. If you are sorting every sprite in the layout, and you have a huge layout with hundreds of items, that is a lot of sorting! If you have the items divided between a three or four layers, then you only have to sort 1/3 or 1/4 of the items.

    Anyway, I got it basically working with the player swapping layers based on Y. I have one more thing to iron out, and then I'll post it.

    EDIT: Here is the version with the player moving between layers. Looks much more complex because of all of the text objects used to show what is going on (layer number, Y, number of sorted objects out of total scenery objects, and cumulative sorts). There are 138 scenery objects, and without dividing them between layers, they'd all be sorted on each collision. Dividing them between two layers cuts the number of sorts, but still not sure of the benefit of this...

    DepthSortingLayerd3.capx

    NOTE: When I say number of sorts, I guess I really mean the number of objects moved to the top or bottom of the layer as the result of a sort. The sort is actually sorting all SortedSprite objects, but they are only moved if they are on the player's layer.

  • I'm registered, but I'm still not sure if I'm insane enough to do it given my family commitments this weekend. I want to, so that counts for a lot...

  • Maybe this would work better?

    For Each (ordered)

    Object: SortedSprite

    Expression: SortedSprite.Y

    Ascending

    ----> Move to front

    Doh! How come I didn't see that? All that work to add in and set that stupid z order variable. You are brilliant, TL22!

    Here is the new improved, simplified version...

    DepthSortingSimplified.capx

    Still bothers me if there are really a lot of objects. Perhaps dividing sorted objects between different layers based on Y, and then, on collision, only sorting the objects on the player's current layer? Or maybe that would be just as much work to keep moving objects between layers? You might be able to assign layers to most objects like scenery at start of layout (or design time), and only have to move certain moving objects like player and NPCs between layers , so it might not be so bad. Any thoughts before I try it out?

  • I've been trying to come up with a method that doesn't use any plugins. This is what I have so far. I created a family called SortedSprite and gave it an instance variable z_order. I made my character and scenery sprites both members of SortedSprite family. Then if the player character collides with another SortedSprite, its z_order instance variable is set to the other's z_order+/-5 (5 is sort of arbitrary # here) depending on the two sprite's y values. A variable is then set to trigger resorting of all of the SortedSprite objects using the For Each (sorted) condition.

    DepthSorting.capx

    (Created with R87, and requires paid version since it uses families.)

    It works pretty well, but rather than resorting all of the sprites, might be better to sort just certain sprites -- say just those within 20 or so points in the z_order variable, which could be done using the For Each sorted expression...

  • I am completely sure that I did everything right, but it still does not work... I have "System - Overlapping object: Portal Action Go to layout2. The player is also Global.

    I appreciate your replies. :)

    System overlapping portal? Do you mean player?

  • Wow! Thanks for the shout out, kyatric. The Memory Match tutorial is now complete -- all 5 parts of it.

  • Or you can download the newest beta of Construct 2 (R86 or later), which implements or, else and while!

    It is a beta, so if you don't want to deal with that you'll have to wait for the next stable release. I couldn't try it out until I finished a project that was using R84, but I'm about to try it now.

  • What Wink said, but you also need to consider the actual player sprite object and how it gets to the new layer.

    Select the player sprite and look at the properties panel. In the first group you'll see a "Global" parameter. If this is "No", which is the default, then 2 things happen:

    a) The player object won't appear on the new layout unless you place it there, either at design time or by creating or spawning it.

    b) The instance variables for that player object are reset to the defaults in the new layout.

    However, if you have global set to Yes, then:

    a) The player object automatically appears on the new layout in the same position it was in in the old layout (but you can reposition it, of course.)

    b) The instance variables that changed in the previous layer retain their values in the new layout.

  • Glad I could help. There are so many different ways to do something, even with a structured tool like Construct 2, that experimenting is really key to understanding. I actually have a fairly complex game in mind that I really want to make, but I'm holding off on making it until I've made a dozen silly little games. Then I think I'll be ready to attack it. So far I'm about 1/2 way there....

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You're welcome.

    That is a great game. I tried unsuccessfully to find an article I read on the creation of Zombieville USA. Pretty interesting the way they did it. Basically used 2D graphics on skinned 3D mesh divided into bodyparts and animated in Maya. You can find more about it in the Unity3d.com forum if you search for mikamobile and zombieville.

    If you plan to target mobile devices you might consider switching from mouse to touch as your input, but setting use mouse input to yes so that you can still test with the mouse.

    I switched the conditions for mirror because it seemed to me the characters were looking away from direction of travel. Old way is still there, but disabled.

    I also played around a little with the animation speed. If you have already downloaded the capx you might want to download again to see those changes. Basically all I did was create two new instance variables and assign animations speeds to each animation, and set them when the animations are changed.