positioning sprites

For questions about using Classic.

Post » Mon Aug 15, 2011 1:35 am

I have a square-sprite (= background) and a few sprites (= pictures of items). Together they form a list of pictures of the items you can upgrade.

How do I position it all effeciently (for me, as fast as possible) in the event sheet?

For example:
in runtime: right click will display the square, on the x/y where I point, and inside the square I want the other sprites (items) displayed.rogerty2011-08-15 01:36:03
B
16
S
5
G
7
Posts: 599
Reputation: 5,000

Post » Mon Aug 15, 2011 1:51 am

I guess the answer is: making image points and matching them with the hotspot of the other sprites, I now realize.
Is that correct?

But you can't test this out, unless you run the game, if I'm correct.rogerty2011-08-15 01:53:08
B
16
S
5
G
7
Posts: 599
Reputation: 5,000

Post » Mon Aug 15, 2011 9:16 pm

You could do that.

I would position them relatively to the background.

Right click - background - set position to mousex, mousey
            - item - set position to background.x, background.y + 32

You could use a loop to automate it. The only tricky part would be picking the right object, but I am sure there is a way to do that, the just set the position to "background.y + 32 * loopindex" and so on.
B
9
S
2
G
4
Posts: 346
Reputation: 2,726

Post » Mon Aug 15, 2011 11:47 pm

Yes, but what if you move the sprites around, on the canvas, and think: this is how I want it.
Then how do I know how many pixels I insert at the background.x + ? and background.y + ? ?
B
16
S
5
G
7
Posts: 599
Reputation: 5,000

Post » Fri Aug 19, 2011 8:20 am

http://dl.dropbox.com/u/1487524/Scirra/setPositionExample.cap

Have a look at that Rogerty, is this the sort of thing you are meaning? Click and drag the background or the item to move them.

Steven2011-08-19 08:38:25
B
9
S
2
G
4
Posts: 346
Reputation: 2,726

Post » Sat Aug 27, 2011 4:23 pm

Steven, sorry for my late reply.
Thanks for the cap.
Before I ask any questions, was it clear, or does it make any difference, that the player is not supposed to change anything, only me?

The only thing I want to do is: position sprites that overlap eachother in a way I like and keep it that way (since it will be a menu in the game).
B
16
S
5
G
7
Posts: 599
Reputation: 5,000

Post » Sat Aug 27, 2011 4:49 pm

For the process of laying out your menu it doesn't make a difference. Just use a method like Steven's example and note the relative values somewhere. For the game you then hardcode these offets, instead of letting the player move things around.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Sat Aug 27, 2011 8:07 pm

Thanks for the reply Tulamide. I think I can use Steven's method.

I wonder: How do other people deal with this issue?rogerty2011-08-28 18:02:59
B
16
S
5
G
7
Posts: 599
Reputation: 5,000

Post » Mon Aug 29, 2011 8:10 am

http://dl.dropbox.com/u/1487524/Scirra/setPositionMenuExample.cap

Is this more of what you are looking for Rogerty?
B
9
S
2
G
4
Posts: 346
Reputation: 2,726

Post » Sat Sep 03, 2011 3:02 pm

Steven,

Thanks a lot for the cap.
Your 1st cap's method is what I use to find out the x/y offset and hardcode this for the menu.

Your 2nd cap is something I can use for general purposes. Thanks again!

About your 2nd cap: you used the function "clamp".
I have never seen or heard of this before.
I could I have known how to use this?rogerty2011-09-03 15:50:05
B
16
S
5
G
7
Posts: 599
Reputation: 5,000

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests