RPG

This forum is currently in read-only mode.
  • So I feel bad making a new thread, so I might just aggregate all my questions into this one thread.

    ---------

    Hello.

    So this little thingy here: I'm trying to change the Z order of the character and the buildings so that the character appears in front when the Z value is greater and behind when it is less. It works for the first instance, but not the others, so I think this might be a picking problem.

    Also, the cap here has it without families, but I've been trying to do it with families as well. With a family would be awesome cause it means I wouldn't have to have all types of building held within one sprite.

    Thanks

  • Try setting up your events like this:

    <img src="http://dl.dropbox.com/u/2306601/Zorder.png">

    That would also work with families.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • First, don't use system compare to check y positions, because it doesn't pick objects. Doing that doesn't make the cap work, though, because it picks all the buildings with a less .y, and doesn't know which one to put the player in front of.

    What I recommend doing is putting all the objects you want to sort into a family and use the event:

    if family is on screen

    for each family (ordered): family.y ascending

    • family bring to front.

    Keep in mind though that 'is on screen' doesn't take into account zoom or screen rotation, so you might need to use a different method of determining what's on screen, like putting an invisible sprite over the screen, setting it to box collisions and check for collisions with the family.

    You could use PR's method, but I think this way is easier because all you need to do to get another object to sort is add it to the family.

  • Cool. Thanks! I got it working now. I'm sure I'll be back in a few hours with some new problem...

  • Hmmm... Ok. So suppose I want to implement a day/night cycle. Anyone got a way to do this? In my latest cap I've set up shadows, but the problem is the light object emenates light from a point which appears to be on the ground, not several billion metres above the surface.

    So yes. Thoughts?

    http://dl.dropbox.com/u/1378330/RPG_0005.cap

  • Here is a very umm "crude" I guess you could say of doing a day night cycle.

    Its basically only a day but just have it set so much time before it spawns again for the night.

    And to change the speed of the day just set the bullet speed.

    Its not that best but cleaning it up a bit might work for you. The only thing is that if you put objects right under it there shadows will just be like a light on top of it maybe the path of it you could put like a road or something.

    Anyways hope this helps you a bit to figuring away to get a day and night cycle.

    http://www.mediafire.com/?aptiht8po4udyrl

  • Thanks Tricky, that's sort of what I was doing already but its not exactly optimal. I think I might go with a colour change rather than shadows for a day/night cycle.

    Alrighty, new problem. I'm trying to make NPC crowd thingys to, on startup, move to a random node. This isn't working, and again I think its a picking problem. I just can't get my head around it. Thoughts?

    http://dl.dropbox.com/u/1378330/RPG_0007.cap

  • Alrighty, new problem. I'm trying to make NPC crowd thingys to, on startup, move to a random node. This isn't working, and again I think its a picking problem. I just can't get my head around it. Thoughts?

    All of your Crowd_Node sprites have the same ID of 0. But there's also a problem with the picking. Try a For Each NPC_Crowd loop and pick the node with the right ID the other way round: Crowd_Node ID equal to NPC_Crowd Target.

    And you don't have to run the MOVE TO event every tick. There's prolly more room for improvements, but I'm a bit in rush right now. Fixing the IDs and using the loop should work for what you want though.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)