The Daily Click ::. Forums ::. Klik Coding Help ::. 32x32 enemy Movement HELP ME!
 

Post Reply  Post Oekaki 
 

Posted By Message

Windybeard Games



Registered
  14/04/2005
Points
  219

You've Been Circy'd!VIP MemberCandy Cane
27th August, 2005 at 07:53:41 -

Im trying to get an enemy to move with a 32 by 32 movement system (MMF!)
Im using a ball movement with the following code

(for moving up)

*Every 1 second*
Set alterable value of Monster Random(6)

*Only when event loops*
*+Alterable Value of Monster = 1*
Create Curser 0,-32 from enemy
Set direction to UP
Movement Start

*Y Position of Monster = Y Position of cursor*
Set alterable value of Monster to 0
Desrtoy Cursor

*Alterable Value of Monster = 0*
Movement Stop

It works fine once and then when it comes to move up again it ignores the cursor and carrys on into the night?
Whats the matter with my code?

 
n/a

Liquixcat

Administrator
Lazy Coder

Registered
  08/12/2002
Points
  201

VIP MemberLikes TDCKitty
27th August, 2005 at 19:53:40 -

Did you try putting 'only when event loops' underneath 'Alterable Value of Monster = 1'?
Code looks like it should work.

Edit: Even though that seems a little wierdly coded, I would do it differently. Try a different way.

Image Edited by the Author.

 
thinking is like pong, it's easy, but you miss sometimes.

Noyb



Registered
  31/05/2004
Points
  1117

VIP Member
27th August, 2005 at 23:35:31 -

Since you're using built in movement, the monster is likely overshooting the cursor. Change Y("Monster") == Y("Cursor") event to:
*Y("Monster") <= Y("Cursor")+ 2(or whatever margin of error you want)*
*+Y("Monster") >= Y("Cursor") - 2*
Set Alterable value("Monster") to 0
Set Y("Monster") to Y("Cursor")
Destroy Cursor

Alternatively, do both the movement and checking one pixel at a time in a fastloop.

 
"Omg. Where did they get the idea to not use army guys? Are they taking drugs?" --Tim Schafer on originality in videogames

Windybeard Games



Registered
  14/04/2005
Points
  219

You've Been Circy'd!VIP MemberCandy Cane
28th August, 2005 at 07:41:33 -

Thx, i really hate using the built in movement it always fucks up.
cheers for the help,

 
n/a
   

Post Reply



 



Advertisement

Worth A Click