Placing items randomly in a dynamically generated terrain

Posted by Programlocura on Game Development See other posts from Game Development or by Programlocura
Published on 2012-09-27T18:29:14Z Indexed on 2012/09/27 21:52 UTC
Read the original article Hit count: 116

Filed under:

I'm currently working on a 'Tiny wings' like game. I've already asked about the angle of the items in curved lines and i solved (thank you for responses),i'm currently placing the items in random positions, but the terrain it's dynamically and i don't get this working.

I've a vector with the points of the terrain, and i'm doing something similar to this (Iterating trough vector):

if( _SPManager && i % 15 == 0 && i != 0 )
{
    if (  _settings.specialPoints && _currentPoints < _settings.specialPoints )
    {
        _SPManager.addPoint( _hillsPosition[i].x , _hillsPosition[i].y );
        _currentPoints++;
    }
}

But it isn't working as i expected. It isn't displaying the right number of items (Always shows less than i specified).

How do i should place the items?

Thanks :)

© Game Development or respective owner

Related posts about actionscript-3