The Daily Click ::. Forums ::. Klik Coding Help ::. shuffle puck movement
 

Post Reply  Post Oekaki 
 

Posted By Message

lukeshufflepuck



Registered
  22/07/2011
Points
  7
22nd July, 2011 at 13:25:33 -

I am trying to make a shuffle puck typle of movement, I have been using the bounce and giving the puck the same speed as the pushing object but it doesnt give really acurate direction. Any advice greatly appreciated. Is there someway to post the mmf file so you can have a look at what I have? Thankyou

 
n/a

s-m-r

Slow-Motion Riot

Registered
  04/06/2006
Points
  1078

Candle
22nd July, 2011 at 16:50:39 -

You may want to consider using this 'bouncing ball widget':

http://nifflas.ni2.se/?page=Multimedia+Fusion+2

The issue with the bouncing you're encountering is that the Bounce action is not exact, so games based on physics will not be accurate when bouncing objects off of walls or one another. Hopefully the widget Nifflas put together will help you.

I know there are some examples of code out there as well, but I wasn't able to find them with my initial search.

Good luck!

 
n/a

lukeshufflepuck



Registered
  22/07/2011
Points
  7
24th July, 2011 at 17:13:28 -

Thankyou smr I had a look at the link but it looks like it only detects in eight directions and I need the bouncing to be exact. The main issue is the overlapping of the balls when they knock together abit harder. I have been looking at fast loops and advanced direction detection but cannot workout how to use the latter. At the moment when ball_a hits ball_b, ball_a is set to bounce and ball_b sets direction and speed from ball_a. So they bounce apart just like I want but the overlapping of fast balls looks bad.

Thankyou again and even if anyone had an example of any use of advanced detection object in relation to direction that would be awsome.

 
n/a

s-m-r

Slow-Motion Riot

Registered
  04/06/2006
Points
  1078

Candle
24th July, 2011 at 19:55:12 -

How about this? Detect vector objects bouncing off backdrop objects:

http://create-games.com/download.asp?id=8290

Then there's this: a collection of 360-degree engines/widgets with angle detection included.

http://create-games.com/download.asp?id=8261

Maybe the section on bouncing bullets will help.

(PS: Sketchy is pretty much a god, as far as I'm concerned. Maybe sending him a specific question on how to fix your problem would be helpful.)

 
n/a

lukeshufflepuck



Registered
  22/07/2011
Points
  7
25th July, 2011 at 04:10:38 -

Thankyou smr, they are awsome but there is so much I dont understand, my solution will probably be there but it will take me a while to figure out.

My Thinking

ball_a and ball_b overlap.
each ball stores its direction and speed if speed = 0, store other balls direction + 16
enter fast loop.
send each ball in (direction + 16) in the case of 32 directions

I couldnt see how to move one pixel at a time with direction, only speed, so speed it till not overlapping then stop it and apply stored speed and direction.

If its not too convoluted to read how does it sound? It will be executed on around 3 balls + background collisions + paddle (ball agitator)

Is it silly that I can get perfectly what I want with bounce until the balls move too fast and go through each other, would it be fixed if I changed the frame rate to 1000?

I heard something about collision detectors and cos sin in a fast loop, that sounds more like what God might do.



 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
25th July, 2011 at 14:21:36 -

lol @ s-m-r - cheers

The built-in bouncing ball movement definitely isn't going to cut it here.

If you use a custom movement (trig + fastloops), the puck/wall collisions are very easy.
The puck/paddle collisions are still going to be far more complicated, because the collision angle (whether the paddle just glances the puck or hits it "full-ball") determines not only which direction the puck will move in, but also how much energy will be imparted too it (ie. its velocity). It's do-able but tricky.

eg.
http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=235496&Searchpage=2&Main=32239&Words=bouncing+balls&Search=true#Post235496

The real problem comes when you have several collisions happening at once. For example, if a paddle is pushing the puck against a wall, or if several balls are in contact at the same time (think Newton's cradle). That would be *very* difficult to handle properly.

I think your best bet is probably to use one of the physics extensions for this. That would do all the complicated maths for you - you just need to figure out a way to give the paddle mouse-controlled movement.

 
n/a

lukeshufflepuck



Registered
  22/07/2011
Points
  7
25th July, 2011 at 16:13:50 -

Thankyou Sketchy, I emailed you just before I found your reply. I will go and have a look at your link. I heard that the physics extensions are not supported by the ios exporter at the moment. Can advanced direction do anything for me?

 
n/a

lukeshufflepuck



Registered
  22/07/2011
Points
  7
25th July, 2011 at 17:14:23 -

Thanks again Sketchy that example is perfect, I am so releived that the last week of my life has not been a total waste of time. If you or s-m-r are interested I have made a Buddhist Rock/Jazz/Folk album that I give away, I can send it to you or any click brother or sister for free, just email me your name and address.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click