kittiewan's Recent Forum Activity

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

  • Try Construct 3

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

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

kittiewan's avatar

kittiewan

Member since 13 Nov, 2010

None one is following kittiewan yet!

Trophy Case

  • 14-Year Club
  • x3
    Coach One of your tutorials has over 1,000 readers
  • x3
    Educator One of your tutorials has over 10,000 readers
  • Email Verified

Progress

17/44
How to earn trophies