Scrolling Game Development Kit Forum

SGDK Version 1 => Script => Topic started by: AjVback on 2005-05-24, 04:40:01 AM

Title: Auto-Sprite generating
Post by: AjVback on 2005-05-24, 04:40:01 AM
Hi,
I was wondering,

Would it be possible, NOT would someone plase do this for me, Would it be possible to write a script which automaticly generates sprites. I was thinking of doing this for my racing game so you dont have to define hundreds of civillian cars and slow the game down. The idea is to randomly generate them and delete them when they pass out of view so you only ever have about 5-10 sprites on the map. They would need to apperar on a certain tyile, though so they didnt apperar on a house.
Title: Auto-Sprite generating
Post by: durnurd on 2005-05-24, 10:19:39 AM
Yes, it would be possible.  Looking at Gold Yoink code, using:

Code: [Select]
Set oNewSprite = NewSpriteDef
oNewSprite.Name = "Car" & nEnemyNum
Set oNewSprite.rPath = oNewPath
Set oNewSprite.rLayer = oEditLayer
Set oNewSprite.Template = oCacheEnemyTemplate


and the big one
Code: [Select]
oMap.AddSpriteDef HostObj.AsObject(oNewSprite)

You can look at the full code to find out where it gets oNewPath, oEditLayer, etc. from.  Find it here (http://gamedev.sourceforge.net/Help/GoldYoink.html)