Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: ginanubismon on Fri 19/05/2006 20:01:17

Title: Coding random patterns.
Post by: ginanubismon on Fri 19/05/2006 20:01:17
Is there a way to create a random path for small ball like a pinball?

I was thinking of adding a small mini-game of pachinko for fun (and perhaps extra prizes and to be different ;D ) and I was wondering what kind of scripting would be needed.
Title: Re: Coding random patterns.
Post by: R4L on Fri 19/05/2006 21:56:37
Well, you would have to create ball physics, and that would be a little bit of code. Use the Maths functions in AGS to do this. Also, you might need to code in a SINE table. Heres a link to the SINE table

http://www.2dadventure.com/ags/SINE_TABLE.zip

Theres the demo game, and if you open it in AGS you'll see the code for it all.
Title: Re: Coding random patterns.
Post by: Kweepa on Fri 19/05/2006 22:23:12
Whoa there! There is no need for that "SINE table" any more, since AGS has built in functions for sin, cos etc.

Writing a pachinko simulation from scratch would be pretty difficult for a beginner. You could fake it by having each ball object decide randomly whether to fall to the left or right (using "Random(1)") of the next pin.
Title: Re: Coding random patterns.
Post by: R4L on Fri 19/05/2006 22:33:05
Quote from: SteveMcCrea on Fri 19/05/2006 22:23:12
Whoa there! There is no need for that "SINE table" any more, since AGS has built in functions for sin, cos etc.

It was just a little example to maybe help him get on track.  ;D
Title: Re: Coding random patterns.
Post by: Kweepa on Mon 22/05/2006 01:18:54
Here is a pachinko physics demo with source code, for AGS2.72.
http://www.kweepa.com/step/ags/tech/pachinko.zip (http://www.kweepa.com/step/ags/tech/pachinko.zip)
It's probably not much use to you but I felt inspired to write it.
Includes a Math3d module and a Collide3d module (although obviously this demo only uses 2 of the 3 d).
Title: Re: Coding random patterns.
Post by: R4L on Mon 22/05/2006 02:50:48
holy crap! :o Thats awesome Steve! Where is this collide 3d?
Title: Re: Coding random patterns.
Post by: Kweepa on Mon 22/05/2006 03:13:34
It's the module "Collide3d.scm" in the zip file. It doesn't do very much - just sphere v sphere, sphere v capsule, moving sphere v sphere, and moving sphere v capsule.