Help on enemy movement please

For questions about using Classic.

Post » Fri Dec 09, 2011 2:53 pm

Hiya, im new to the forums (and pretty new to construct too)
im using construct classic so i can learn and master it while i wait for the full release of C2.
right down to the problem, i making a platformer at the moment and in level 3 i want enemies to start appearing, so ive got my little enemies and i need them to move left and right, stopping and turning round before falling off the platforms like a bunch of lemmings or walking into walls like a delirious drunk..

ive taken out the code that didnt work (from platform school :L)
so i was wondering if anyone could write me a way that works, i would really appreciate it as ive been racking my brains and scouring the internet trying to find a way with no luck.
Btw great piece of software, so much better than game maker :)
B
5
G
1
Posts: 13
Reputation: 577

Post » Sat Dec 10, 2011 1:08 pm

ok so 74 views but no answer, i guess i didnt really explain enough, i just want my enemies to have simple left-right movement from 1 side of a platform to the other like the enemies in mario.
B
5
G
1
Posts: 13
Reputation: 577

Post » Sat Dec 10, 2011 1:18 pm

here is a picture of whats going on bizla2011-12-10 13:19:41
B
5
G
1
Posts: 13
Reputation: 577

Post » Sat Dec 10, 2011 1:18 pm

http://www.flickr.com/photos/58682892@N07/6486537673/
B
5
G
1
Posts: 13
Reputation: 577

Post » Sat Dec 10, 2011 4:49 pm

The easiest method is going to be to add some dummy sprites at the end of each platform. Then on collision with the dummy, turn the opposite direction. Like:
-+enemy on collision with dummy
->enemy set angle to angle(enemy.x,enemy.y,dummy.x,dummy.y)-180
Image Image
B
161
S
48
G
91
Posts: 7,359
Reputation: 67,273

Post » Mon Dec 12, 2011 11:23 am

thank you very much newt, im just trying that now, i'll let you know how it goes :)
B
5
G
1
Posts: 13
Reputation: 577

Post » Mon Dec 12, 2011 11:32 am

well it half worked, my enemy will turn around if he hits the dummy on the right (so he's now travelling left) but he walks straight through the left one instead of turning back again :S
B
5
G
1
Posts: 13
Reputation: 577

Post » Mon Dec 12, 2011 12:18 pm

here is the .cap file, the enemies are on layout 6, would you mind taking a look at the events sheet and show me where ive gone wrong please?
http://www.box.com/s/txxyij4rghepk9oyjzdu
B
5
G
1
Posts: 13
Reputation: 577

Post » Mon Dec 12, 2011 5:25 pm

Couldn't find a layout 6, or where you you were needing the ai, but here is a simplified version of the method.

platai
Image Image
B
161
S
48
G
91
Posts: 7,359
Reputation: 67,273

Post » Tue Dec 13, 2011 11:01 am

oh, thats really strange :L sorry about that, thanks alot for the help newt
B
5
G
1
Posts: 13
Reputation: 577

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 9 guests