Player and monster movement in a non platform game

Get help using Construct 2

Post » Sat May 04, 2013 5:29 pm

Hello,

Drop box link here: https://dl.dropboxusercontent.com/u/19981154/Monstermovement.capx

I wrote some event so the player and monsters in my game can move like the characters in double dragon. The conditions are:

1) Player can move in all 8 directions, but only faces left or right.
2) Monsters move toward player, but only faces left or right depending on relative position to player.

Right now, my monster has no movement behavior. At every tick, it's position and angle are caculated by an event.

My questions are:
1) Is there a smarter way to move the monster? Right now it moves x pixels per tick.

2) The current method will be better if I could have more control over the speed. I know I can set it to x pixels per 0.y seconds, but I rather control the numerator. Does Constructor support x.x pixels per tick? For example, 3.5 pixels per tick or 3.6? How precise can it be?

3) In the capx file, event 8 is used to describe this monster's movement. If I want most monsters in the game to have this behavior, then is there a way to apply it universally? Or do I have to copy and paste it for each sprite?

Thanks for reading!

Edit: here is a follow up question. How do I set the angle/mirror state of each monster instance? Right now when I set one, all of them change.KiratTheKop2013-05-04 20:16:49
B
11
S
2
Posts: 68
Reputation: 982

Post » Sat May 04, 2013 9:30 pm


2) The current method will be better if I could have more control over the speed. I know I can set it to x pixels per 0.y seconds, but I rather control the numerator. Does Constructor support x.x pixels per tick? For example, 3.5 pixels per tick or 3.6? How precise can it be?

Sweet! Constructor moves the monsters at different speeds even if the speeds are only 0.1 pixels/tick apart.
B
11
S
2
Posts: 68
Reputation: 982

Post » Sat May 04, 2013 10:14 pm

You should read the section of the manual covering "dt" or delta time. It ensures consistent movement speed across all browsers/computers. Basically you multiply your speed modifier by dt.

https://www.scirra.com/tutorials/67/delta-time-and-framerate-independence
B
8
S
2
Posts: 63
Reputation: 1,223


Return to How do I....?

Who is online

Users browsing this forum: Governador, RookieDev, tarek2, Thelegendvinny and 18 guests