The Daily Click ::. Forums ::. Klik Coding Help ::. Moonnsterr gravity+movement
 

Post Reply  Post Oekaki 
 

Posted By Message

erghhhhx



Registered
  15/11/2007
Points
  311

Mushroom
13th February, 2008 at 10:43:59 -

Maybe you think this is obvious, but I've never done it..

I want my "monsters" to act like the koopas in mario, moving blindly towards a direction and the changing it when hitting a wall or obstacle. And falling when there's no ground under it. Anyone have a suggestion?

Thx.

 
n/a

Ricky

loves Left For Dead 2

Registered
  28/12/2006
Points
  4075

Has Donated, Thank You!Game of the Week WinnerVIP MemberWii OwnerHero of TimeGOTM Winner! - November 2009I am an April Fool
13th February, 2008 at 15:55:03 -

Image

There you go. Sorry I didn't feel like converting it to text.

13. It goes right if its facing right
14. It changes direction if overlapping something
15 left
16 like 14 only for the left collision
17 goes down
18 oops, theres a platform, goes back up


note that this gravity doesn't accelerate. Its a rather simple enimy movement and behaves just like a goomba.

 
-

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
13th February, 2008 at 18:43:58 -

A few small little differences though is that goombas collide with each other and don't change direction when they touch the floor.

 
.

erghhhhx



Registered
  15/11/2007
Points
  311

Mushroom
13th February, 2008 at 19:23:32 -

Hrgh. It really doesn't work. It climbs over the obstacles and it won't change direction.

EDIT: I tried changing it's initial direction to left. When it's goin left and hits an obstacle it changes direction and moves on fine, but when its moving right and hits an obstacle it just keeps movin past it. Weird...

Image Edited by the Author.

 
n/a

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
13th February, 2008 at 22:22:59 -

use ball movement instead of adding and subtrating the x values. and use collides with background obstacle instead of overlapping.

keep everything that has to do with the y values. i.e. - subtract when overlapping and add when not overlappying.

Image Edited by the Author.

 
n/a

Ricky

loves Left For Dead 2

Registered
  28/12/2006
Points
  4075

Has Donated, Thank You!Game of the Week WinnerVIP MemberWii OwnerHero of TimeGOTM Winner! - November 2009I am an April Fool
14th February, 2008 at 00:23:27 -


Originally Posted by Toxic Avenger
Hrgh. It really doesn't work. It climbs over the obstacles and it won't change direction.

EDIT: I tried changing it's initial direction to left. When it's goin left and hits an obstacle it changes direction and moves on fine, but when its moving right and hits an obstacle it just keeps movin past it. Weird...

Image Edited by the Author.



This is a working engine. Possible causes of your problem:
1. It must be ordered exactly as above in order to work
2. HOT SPOTS The Hot hotspot must be in the center of the object at all times.
3. Frames must all be the same size all the time
4. Disable fine collision detection



 
-

Ricky

loves Left For Dead 2

Registered
  28/12/2006
Points
  4075

Has Donated, Thank You!Game of the Week WinnerVIP MemberWii OwnerHero of TimeGOTM Winner! - November 2009I am an April Fool
14th February, 2008 at 00:35:14 -


Originally Posted by I am AndyUK (honest)
A few small little differences though is that goombas collide with each other and don't change direction when they touch the floor.



These guys don't change direction when they touch the floor. They did in my old game though .
For changing direction when colliding with each other. Insert this event after or before all the others:
-Duck overlapping duck
+set direction to direction +16

note: If they land on top of each other, this code will make them get stuck on each other. To avoid that, you'll have to wait until I or someone else come up with a solution (most like involving setting a flag, spreading avaule, and doing a fast loop)


 
-

erghhhhx



Registered
  15/11/2007
Points
  311

Mushroom
14th February, 2008 at 07:00:49 -

Hah! It works.
I changed the order of the events like you said + I edited the animation a bit.

Thx for your help, people.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click