# How do I control a simple movement

0 favourites
• 9 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
• This is a little embarrassing but I'm a bit stuck.

I'm very new to Construct and I'm finding the things that should be hard, easy to do... and the things that should be easy, hard to figure out!

Basically, I have this little block character on screen. He's a simple little chap, that only faces left or right.

I'm trying to figure out how to give the guy the ability to move in all 8 directions but to only face left or right while doing so.

I want him to do this in a random fashion, like he's just wandering around the screen.

How can I go about it?

(Eventually, I plan to have lots of these characters (all different colours) wondering about - do I have to program each separately, or is there a built in behaviour clone feature that I've yet to discover?)

• You could use the 8-directions behaviour

• in the properties set angle = no

and set your character mirrored through events..

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• Well, that did the basics for the movement that I was after, but how do I have it so I don't have to press the arrow keys to have the guy move?

I want the little chap to move about by himself randomly.

Thanks for the reply, by the way. Much appreciated.

• You can have 8 directions simulate control left, right, up and down..

You only have to create the conditions for it..

for example:

Give the chap instance variable movement (number)

every random(1,5) seconds

for each chap

• set chap variable movement : choose(1,2,3,4,5,6,7,8,9)

for each chap

• chap variable movement = 9

-- chap 8 direction simulate control up

-- chap 8 direction simulate control right

• chap variable movement = 5

-- chap 8 direction simulate control left

I used 1 to 9 so you can easily compare them to the numbers on the numpad..

• That worked brilliantly, thank you.

Tell me.... is it possible to do all that from with a function of some sort.

I mean, one standardised movement method, rather than having to copy 8+ events over and over for each version of the chap sprite?

As I said earlier, I plan to have lots of these sprite mulling around but with different appearances, therefore different sprites.

• You could use the function object and put the events in there..

Then for each sprite call the function..

you could call the function with parameter choose(1,..) and use that param to set the direction instead of an instance variable..

• I think that may well do the trick.

Thanks a lot for the help.

• I'm confused again.

I'm learning so much bit by bit but something's gone wrong.

I've got all the actions as before, in a function.

I have the call from the function to choose (1,2,3,4,5,6,7,8,9) as mentioned before.

The little character mirrors perfectly,

But he's stopped moving!!! The direction simulate etc. lines have ceased to work!

What's gone wrong.

I even added a line after the Direction Simulate line in each action, to set x to 10, x to 20, x to 30, x to 40 etc.... and they all worked. He skipped to 10,20,30,40, etc.

But he doesn't just move like he did.

Any ideas? (I'd hate to think the little guy was just moving 1 pixel on each call!)

• Again... I figured it out.

A function was a bad idea AND I've even got multiple guys moving about.

All this I've learned in a matter of hours.

Construct 2 is mighty fine.

• 9 posts