..use 8 direct behaviour to move in steps of 32?

Get help using Construct 2

Post » Thu Dec 01, 2011 9:20 pm

I'm trying to recreate a game i was working on and I need my character to move in steps of 32 pixels at a time, is that possible using the 8 direction behaviour?

Edit: I tried using Set X to player.X + 32 in the event sheets but I need to have collision.

http://www.youtube.com/watch?v=22k0tQmHiGQNickydude2011-12-01 21:30:37
B
72
S
25
G
9
Posts: 382
Reputation: 10,649

Post » Thu Dec 01, 2011 9:26 pm

hmmmm check the FAQ before posting
B
34
S
16
G
16
Posts: 2,222
Reputation: 16,564

Post » Thu Dec 01, 2011 9:34 pm

Sorry, may be I'm not looking in the right place, could you point it out to me? :)
B
72
S
25
G
9
Posts: 382
Reputation: 10,649

Post » Fri Dec 02, 2011 1:15 am

The 8 direction movement isn't really designed for this kind of use. You should just add events to move it how you want, and detect solids in events as well.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,498

Post » Fri Dec 02, 2011 8:21 am

I asked this question, and the decision has been found:
http://dl.dropbox.com/u/50657347/GridMove.capx

http://www.scirra.com/forum/grid-movement_topic46367.html?KW=Grid+movementalexei2011-12-02 08:24:12
B
18
S
2
G
2
Posts: 21
Reputation: 2,413

Post » Fri Dec 02, 2011 10:14 am

Thanks guys.

@alexei: That's sort of what I'm after but how would I do it without the targets, just the main sprite?
I want to do something like:

>right key is pressed:
... check if there's a solid 32 pixels to the right
......if there isn't move player
... else don't move player

So I need to check 32 pixels in the direction the player will be moving first.
B
72
S
25
G
9
Posts: 382
Reputation: 10,649

Post » Fri Dec 02, 2011 5:58 pm

@Nickydude: if you don't want to use the targets, you need to use an array to store the tiles.
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Fri Dec 02, 2011 7:22 pm

And if you don't want to use targets or arrays use this:
http://dl.dropbox.com/u/5426011/examples%208/grid.capx
Only remember to keep the player sprite a bit smaller than the grid size. Two 32x32 objects 32 pixels apart count as overlapping in C2.
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Fri Dec 02, 2011 7:42 pm

[QUOTE=R0J0hound]Two 32x32 objects 32 pixels apart count as overlapping in C2.[/QUOTE]
That's interesting, good to know. I'd like to hear from Ashley about this, does it have to be this way? I like it more in the CC where two objects in the same situation don't count as overlaped.
ImageImage
B
25
S
6
G
8
Posts: 773
Reputation: 6,643

Post » Sat Dec 03, 2011 3:49 pm

Yes, two adjacent objects count as overlapping by design. The platform movement doesn't work properly without this. It's because CC used a pixel-perfect collision engine but for C2 we changed to a polygon system which works a little differently.Ashley2011-12-03 15:50:39
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,498

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 3 guests