RPG

For questions about using Classic.

Post » Mon Nov 08, 2010 9:17 am

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 :D
B
55
S
12
G
8
Posts: 339
Reputation: 9,314

Post » Mon Nov 08, 2010 3:32 pm

Try setting up your events like this:



That would also work with families.
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Mon Nov 08, 2010 3:41 pm

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.
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Tue Nov 09, 2010 3:11 am

Cool. Thanks! I got it working now. I'm sure I'll be back in a few hours with some new problem...
B
55
S
12
G
8
Posts: 339
Reputation: 9,314

Post » Tue Nov 09, 2010 4:47 am

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
B
55
S
12
G
8
Posts: 339
Reputation: 9,314

Post » Tue Nov 09, 2010 7:13 pm

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.

[url:2by23tux]http://www.mediafire.com/?aptiht8po4udyrl[/url:2by23tux]
B
2
G
2
Posts: 17
Reputation: 684

Post » Fri Nov 12, 2010 6:56 am

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
B
55
S
12
G
8
Posts: 339
Reputation: 9,314

Post » Fri Nov 12, 2010 10:46 am

[quote="cow_trix":3vjgo1of]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?[/quote:3vjgo1of]

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.
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests