How to make a mario style enemy?

Get help using Construct 2

Post » Sun Jan 27, 2013 7:21 am

I cannot figure this out, how can I make a Mario style enemy that just patrols back and forth?

I want it so that if it is between two objects, when it hits one object it will start moving left and if it hits the other object it starts going right.. and if there is no object at all, just keep going left.
B
6
Posts: 10
Reputation: 503

Post » Sun Jan 27, 2013 8:28 am

Use the platform behaviour

make sure there is no default controls, then use the "simulate press left" "simulate press right" to control the movement when the enemy hits a trigger point.

There is a good tutorial on platformers on the main page somewhere.
B
9
S
3
Posts: 148
Reputation: 1,738

Post » Sun Jan 27, 2013 8:30 am


http://www.scirra.com/tutorials/253/how-to-make-a-platform-game/page-7

Thar you go! even teaches you how to make jumping on their heads work. its a great tutorial I highly recommend it.

Awakening2013-01-27 08:31:27
B
9
S
3
Posts: 148
Reputation: 1,738

Post » Sun Jan 27, 2013 9:37 am

@coltonrawrr - Here's my .capx of my game I'm testing new things on. It's by no means a finished work. But it should show you what you're looking for. When you look at the Event Sheet, scroll to the bottom to find the "Dr Box Movement" group. That's pretty much what you'll find in the tutorial @Awakening showed you.

Also, you can use a global variable to track your enemy's direction, but if you choose to limit it to a local variable (as I did - see the Local static text MrBoxDirection = "left" variable declaration at the start of the group), be sure to set the variable to "static" so it doesn't reset its own value every tick (which would override any changes in direction and keep it going the same way indefinitely). Think of static like electricity: it's always ready to be on the move and change. Non-static resets - or is re-declared - ever new tick.

Does that help? :) Anything we can clarify?
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
113
S
20
G
8
Posts: 741
Reputation: 13,661

Post » Mon Jan 28, 2013 6:16 am

Quick question, what is the "PlayerBox" for?
B
6
Posts: 10
Reputation: 503

Post » Mon Jan 28, 2013 7:08 am

[QUOTE=coltonrawrr] Quick question, what is the "PlayerBox" for?[/QUOTE] Usually acts as hitbox which are for checking collisions. Here is example image:


Those boxes are same type of boxes as "PlayerBox" is and will act as sensor for checking collisions between objects more efficient.CoffeeOD2013-01-28 07:09:45
B
7
S
1
Posts: 51
Reputation: 1,087

Post » Mon Jan 28, 2013 5:32 pm

Ah, that makes sense, thanks (:
B
6
Posts: 10
Reputation: 503


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot], zenox98 and 24 guests