The Daily Click ::. Forums ::. Klik Coding Help ::. Help with a 8 direction movement with collision
 

Post Reply  Post Oekaki 
 

Posted By Message

Jon C-B

I create vaporware

Registered
  23/04/2008
Points
  237

I'm an alien!VIP MemberWii OwnerI donated an open source project Santa Hat
29th April, 2010 at 23:30:54 -

I can make a 8 direction movement pretty well, but collisions just aren't working. Does anyone have an example of one?

 
n/a

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
30th April, 2010 at 00:49:09 -

What? For custom 8-dir you should only need 4 sensors (square body)

 
n/a

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
30th April, 2010 at 00:59:10 -

That's real helpful Gamester AGAIN!!!

That's two posts requesting help that you have replied on and neither have been any use. One of them was mine so granted I might be a little jaded but i really see no point in posting it what you are going to post is unconstructive.

He asked for a working example so if you are going to post either provide links to an example you KNOW is working or talk him through it.

This is exactly the kind of post that is being discussed on the "What do you think happened to this place?" topic.

@Jon C-B unfortunately i am unable to help directly but if you posted a copy of your engine then i could have a look for you to see if anything was immediately obvious.

Edited by lembi2001

 
n/a

Jon C-B

I create vaporware

Registered
  23/04/2008
Points
  237

I'm an alien!VIP MemberWii OwnerI donated an open source project Santa Hat
30th April, 2010 at 03:03:37 -

Well I have manadged to do collisions of some sort. But it just doesn't seem right, it seems like you get stuf in the walls and stuff. http://www.mediafire.com/?zmnhztdenyw

 
n/a

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
30th April, 2010 at 03:14:15 -


Originally Posted by lembi2001
That's real helpful Gamester AGAIN!!!

That's two posts requesting help that you have replied on and neither have been any use. One of them was mine so granted I might be a little jaded but i really see no point in posting it what you are going to post is unconstructive.

He asked for a working example so if you are going to post either provide links to an example you KNOW is working or talk him through it.

This is exactly the kind of post that is being discussed on the "What do you think happened to this place?" topic.

@Jon C-B unfortunately i am unable to help directly but if you posted a copy of your engine then i could have a look for you to see if anything was immediately obvious.



Geez calm down LOL.

Sorry that I am working at the moment (7 days a week 8-15 hours a day, mind you) and can't set centuries of time aside to help Jon C-B figure out how to make an 8 Directional custom engine.

Since I could not do that, I just recommended that he should try using 4 sensors with a square body.

@Jon

To make this work, create 4 sensors for your body (the black square) - 1 for each side. Always position these sensors 1 pixel away from the body.

Now remove the diagonal events.

Create a counter and name it direction or something of the sort.

Now

Repeat while up is pressed
+ no other directions are pressed
-Set Counter to 1

Repeat while up is pressed
+ repeat while right is pressed
+ no other directions are pressed
- Set Counter to 2

Do this for all 8 directions. This will ensure that your character always faces the proper direction later.

Counter = 1
-Set character direction to up

Counter = 2
-Set character direction to up right

etc.

You may have to play around with this as I'm in a rush and typing this off of the top of my head.

Now all you have to do is

User is holding up
+ top sensor is not overlapping an obstacle
- Move up

User is holding right
+ right sensor is not overlapping an obstacle
-Move right

User is holding down
+ bottom sensor is not overlapping an obstacle
-Move down

User is holding left
+ left sensor is not overlapping an obstacle
-Move Left

You do NOT need diagonal events when making 8 directional movements.

Edited by GamesterXIII

 
n/a

Watermelon876



Registered
  16/04/2009
Points
  27

I am an April FoolVIP Member
30th April, 2010 at 05:05:54 -

The detector is smaller than the player body which is part of the problem. I kind of like that, because it allows the player to get close to a wall and ... I like it? The reason that collisions aren't working is that you just add or subtract 4 whenever the player trys to touch the wall. This prevents the player from fully getting to the wall. use a fastloop system... I'll have an example ready in a bit, but I don't have time right now. Do not use Gamester's method, it uses too many unnecessary detectors.

 
Awesomeness is Watermelon.
*/l、
゙(゚、 。 7
l、゙ ~ヽ
じしf_, )ノ
This is Koji. Copy and paste Koji to your sig so he can acheive world domination.

Don Luciano

Heavy combat pancake

Registered
  25/10/2006
Points
  380

VIP Member
30th April, 2010 at 11:34:46 -

I found using stop very usefull instead of detectors, even if u use custom movement, just set object movement to 8 dir and set not move at start, it will still be very good at collisions. U can use it for the detector or the player it doesnt matter. Just do condition collides with wall objects, = stop
Also u should use overlaping negates to make it perfect.

Actually nevermind that, detectors should be more better anyways.

Edited by Don Luciano

 
Code me a sausage!

Jon C-B

I create vaporware

Registered
  23/04/2008
Points
  237

I'm an alien!VIP MemberWii OwnerI donated an open source project Santa Hat
1st May, 2010 at 00:50:47 -

Thanks a ton! but only one directoin works for some reason... http://www.mediafire.com/?hmymafz4wyz

 
n/a

Jon C-B

I create vaporware

Registered
  23/04/2008
Points
  237

I'm an alien!VIP MemberWii OwnerI donated an open source project Santa Hat
1st May, 2010 at 14:10:50 -

Never mind i fixed it. I just had to make the detectors smaller. thanks again

 
n/a
   

Post Reply



 



Advertisement

Worth A Click