Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Ezekiel000 on Tue 09/10/2012 10:46:57

Title: Creation and destruction of objects on the fly?
Post by: Ezekiel000 on Tue 09/10/2012 10:46:57
I was wondering how the marbles part of Kweepa's Mega Demo was done?
(http://s14.postimage.org/pz3jmibbj/Screenshot.png)
http://www.kweepa.com/step/ags/games/MegaDemo.zip (5Mb) (http://www.kweepa.com/step/ags/games/MegaDemo.zip)

I'm trying to create a mini game where objects randomly fall from the top of the screen and the player has to move the character to catch the objects.
Title: Re: Creation and destruction of objects on the fly?
Post by: Crimson Wizard on Tue 09/10/2012 11:06:06
AGS does not allow to create/delete object dynamically other than DynamicSprite and DrawingSurface.
Haven't seen Kweepa's script, but those things are usually done either by reusing a limited number of graphical objects (like GUI buttons, Room Objects or  Characters for instance), or storing objects data (coordinates) in your own arrays and drawing them manually on screen.
Title: Re: Creation and destruction of objects on the fly?
Post by: Ezekiel000 on Tue 09/10/2012 22:34:11
Ah right thanks, I'll try just reusing room objects.
Title: Re: Creation and destruction of objects on the fly?
Post by: Kweepa on Wed 10/10/2012 00:48:10
I just used a large array, and RawDraw.
The source code for the demo is here:
http://www.kweepa.com/step/ags/tech/megademosrc.zip

Depending on how many objects you want to have, this might be a better approach than room objects.
Title: Re: Creation and destruction of objects on the fly?
Post by: Ezekiel000 on Wed 10/10/2012 08:35:27
Thank you, I'll do a few tests to see which way I want to go.
Even if I reuse room objects it is always interesting to learn and understand new techniques.