Game Development Community

Script question

by Brian E Charapata · in iTorque 2D · 11/09/2011 (3:04 pm) · 2 replies

Lets say I have a game board. I have a (bead) sprite object on the side of the board. I want to position up to 20 identical sprite bead objects on the board during game play.

Question: If I wanted to spawn 20 identical (bead) sprite objects on the board. During design, would I need to have dragged, created and positioned 20 bead objects on the side of the board then during game play move them on the board as needed?

Question: Instead can I create bead objects on the fly during game play?

Thanks,

Brian

#1
11/09/2011 (7:03 pm)
You can do either depending on your preferences.

You can definitely create an object from scratch in code however it's probably more appropriate for you to do a combination of both.

You should check out the "feature demo" from 1.5, the shooting is handled by a behavior defined in the file timerShootsAdv.cs which is under ai directory.

In it you can see how it takes a projectile object and clones it with behaviors.

You should be able to use that to clone whatever game pieces you need to place on your board.
#2
11/09/2011 (7:50 pm)
Excellent. Thanks David. I will check out the "feature demo" as you suggested.