8-direction for non-player character

For questions about using Classic.

Post » Wed Apr 22, 2009 10:17 pm

I'm trying to get the 8-direction behaviour to work for a non-player entity, but it behaves strangely.

I recreated the problem in a simple pong-game:
[url:pdc8a7vl]http://www.willhostforfood.com/access.php?fileid=63752[/url:pdc8a7vl]

Am I doing it wrong?
B
4
G
3
Posts: 39
Reputation: 978

Post » Fri Apr 24, 2009 9:44 pm

I had a good go at trying to do this, but no idea how to solve it. All I could do was set the Opponent's Y pos. to the Ball's Y pos.

You still having problems with it?
B
2
G
3
Posts: 40
Reputation: 930

Post » Fri Apr 24, 2009 10:31 pm

Looks like it might be a bug with the 8 Direction behavior, sliding around solids like that when it shouldn't. Would require some more testing to confirm.

Anyway, here's a sort-of fixed version that will at least keep your opponent's bat where it should be:

http://dl.getdropbox.com/u/529356/pong.cap
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Fri Apr 24, 2009 11:19 pm

I find it hard to believe no one has attempted to make a pong game before to discover this possible bug.
B
2
G
3
Posts: 40
Reputation: 930

Post » Fri Apr 24, 2009 11:32 pm

People have made Pong before, but I don't believe 8 Direction was ever used to make an opponent.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sat Apr 25, 2009 12:05 am

The 8 direction movement is designed for control by human input, and it's not designed for automatic control, which is why (I guess) nobody's tried to make pong like this before. It's really easy to control automatically with some simple events - or an automatic behavior like Bullet - but 8 direction is the wrong choice.

What was the exact problem? You didn't specify. I'm assuming it's the object moving sideways. If you disable rotation in the behavior to stop it trying to set the object angle, and always set its Y coordinate to a certain value, it seems to work OK, but as I said, best find another way to do it.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Sun Apr 26, 2009 1:23 pm

Too bad the 8-direction behaviour doesn't play nice.
I solved the problem by using the car behaviour.

You can see my solution here:

http://willhostforfood.com/access.php?fileid=64209

Thank you all for your input, now if only the Construct programmers would make the 8-direction work properly with npc's.
B
4
G
3
Posts: 39
Reputation: 978

Post » Sun Apr 26, 2009 2:31 pm

I think we should have 8-direction opton as either player controlled or what.. and of course methods to enable controlling the entity through the event coding.
B
16
S
10
G
5
Posts: 255
Reputation: 3,934

Post » Sun Apr 26, 2009 3:37 pm

I still would not recommend you use the car behavior for automatic movement! As I said they're not designed for NPC use which is why you probably find them "not working properly"!
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Mon Apr 27, 2009 11:10 am

The car behaviour works fine for NPC's. The enemy paddle now moves reasonable smooth, and bumps into the solid walls as expected.
B
4
G
3
Posts: 39
Reputation: 978

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests

cron