Posted: 20th Aug 2011 18:49
Hi! I've been making my 1st game with AppGameKit, but "A wild Problem appeared!" (I encountered a problem): I don't know the best way to create enemies (as sprites).
My code would spawn those automatically, but should I use Type and arrays, or something?
Here's part of my code:
+ Code Snippet
Type ENEMIESType
    ex as integer
    ey as integer
endtype
SetClearColor (255,0,0)

SetPhysicsGravity (0,0)

rem VARIABLES
i = 20
iMAX = 21

do

rem SPAWN ENEMIES
if counter>=100
    SpawnEnemy(i)
    counter=1
    enemies_on=1
    i=i+1
    iMAX=iMAX+1
endif

rem CONTROL ENEMIES
for i=20 to iMAX
if enemies_on=1
    ex# = GetSpriteX(i)
    ey# = GetSpriteY(i)
    SetSpritePosition (i, ex#, ey# )
    ex# = ex# + 0.5
    ey# = ey# + 0.5
    endif
next i


counter=counter+1

 Sync()
loop


function SpawnEnemy(i)
    CloneSprite(i,2)
    SetSpritePosition (i,240-13.5,160-13.5)
    SetSpritePhysicsOn (i,2)
    SetSpritePhysicsCanRotate (i,0)
    PlaySprite (i,10,1,1,10)

endfunction


So that is not the whole code, there I spawn a enemy when counter is enough, and put it moving, but there comes an error, that i does not exists (at control enemies).

Any suggestions or help would be greatly appreciated.

Thanks,
TP
Posted: 20th Aug 2011 20:00
First I would make sure your Enemy Type has a Sprite ID so you can easily refer to it in your code. I would also make it an array of Enemies so you can update each one in a for/loop.

Those two things will help you out a lot.
Posted: 21st Aug 2011 4:47
Well, I would say that `i` is your problem at a quick read over. You have a variable called `i` that you inc in the prior loop. You then go into a for next loop using i.. it's bound to cause issues, as the loop forces i to step from 20 to imax, yet you set i to be 21 in the prior loop.. It can't be both.
Posted: 21st Aug 2011 5:32
Hi, I put together a quick program example, showing you how to create 100 enemies, assign them to an array, and keep track of it all. It's simplistic, you tap the screen or click the mouse to create an enemy. There is a maximum enemy count of 100, once you hit that ceiling, the first enemy created is simply recycled and repositioned on the screen. This works on the assumption that in a game siltation, it would have been killed or left the screen by the time 100 shows up. You can also write in a function that checks for destroyed enemies and recycles them instead without too much effort.

Anyway heres the code:

+ Code Snippet
setvirtualresolution(1024, 600) //sets the virtual resolution for specific co-ordinates being used across all platforms
SetSyncRate( 30, 0 ) //keeps the program running at about 30 frames per second, 0 isn't precise, when the program isn't doing anything it makes the program sleep instead of thrashing the cpu, thus keeping the program power efficent.

type _obj
    id //object ID
    x# //x axis position
    y# //y axis position
endtype

dim enemy[99] as _obj //create an array with 100 slots (0 is counted as a slot)
count = 0 //setup a count to keep track of the number of enemies created

image = loadimage("ball.png") //load our image file and assign it to the name image

do //start our main loop
    if getpointerpressed() = 1 then create_enemy() //check to see if the screen has been tapped or the mouse pressed if it has we create an enemy and randomly position it on the screen.
sync() //this updates the visual information to the screen and keeps the program in time with itself.
loop

function create_enemy()
    count = count + 1 // we increase our count by 1
    if count > 99 then count = 0 //if the count reaches 99 we reset it and start recycling
    if enemy[count].id > 0 //this means the enemy exists so we just reposition it randomly
        enemy[count].x# = random( 0, 1024) //generate a random position for our enemy and assign it to our array count is a global so it's constantly upated
        enemy[count].y# = random( 0, 600)
        setspriteposition(enemy[count].id, enemy[count].x#, enemy[count].y#) //set an enemy that already exist to go to a new location.
    else
        enemy[count].id = createsprite( image ) //create a new enemy, colour it and position it randomly
        setspritecolor( enemy[count].id, random( 0, 255), random( 0, 255), random( 0, 255), 255 )
        enemy[count].x# = random( 0, 1024)
        enemy[count].y# = random( 0, 600)
        setspriteposition(enemy[count].id, enemy[count].x#, enemy[count].y#)
    EndIf
endfunction
Posted: 25th Aug 2011 8:57
Thanks! Daniel, that was what I were looking for. But now, I encountered a problem with using "enemies" in my loop. I mean, like controlling them (you can see my code). I bet the problem is with I am trying to use wrong sprite id.

Here's my full code (yeah it is NOT ready yet, so you'll may find something stupid there, I am going to fix 'em)
+ Code Snippet
rem
rem AGK Application
rem
rem A Wizard Didn't Do It!

menu:
SetVirtualResolution ( 480, 320 )



do
 Print("Tap something to start.")
 if GetPointerPressed()=1 then goto game
 Sync()
loop

game:

SetSyncRate( 30, 0 )

type _obj
    id
    x#
    y#
endtype


dim enemy[99] as _obj //create an array with 100 slots (0 is counted as a slot)
count = 0 //setup a count to keep track of the number of enemies created
counting = 1

SetClearColor (255,0,0)

rem PORTAL
LoadImage (103,"portal.png")
CreateSprite (103,103)
SetSpriteOffset (103,22.5,22.5)
SetSpritePosition (103,240-22.5,160-22.5)

rem DUMMY PORTAL
CreateDummySprite(104)
SetSpritePosition (104,240,160)

rem PLAYER
loadimage (101,"player2.png",1)
createsprite (101,101)
FixSpriteToScreen (101,1)
SetSpritePosition ( 101, 150, 146.5 )
SetSpriteOffset (101,13.5,13.5)
SetSpritePhysicsOn (101,2)
SetSpritePhysicsCanRotate (101,0)

rem ENEMY
LoadImage (102,"enemy.png",1)
CreateSprite (102,102)
SetSpriteAnimation (102,27,27,10)
SetSpritePosition ( 102, 50, 0 )
SetSpriteOffset (102,13.5,13.5)
SetSpritePhysicsOn (102,2)
SetSpritePhysicsCanRotate (102,0)
PlaySprite (102,10,1,1,10)

rem SCORES
score = 0
scoreText = CreateText( "Score: "+str(score))
SetTextSize (scoreText,20)


rem PHYSICS
SetPhysicsWallBottom ( 0 )
SetPhysicsWallTop ( 0 )
SetPhysicsWallLeft ( 0 )
SetPhysicsWallRight ( 0 )
SetPhysicsGravity (0,0)

rem JOYSTICK
AddVirtualJoystick ( 1, 50, 270, 10 )
SetVirtualJoystickSize (1,80)

rem VARIABLES


do


rem KEEP PLAYER IN SCREEN
if GetSpriteX(101)>450 then SetSpriteX(101,GetSpriteX(1)-( joystickX# )*2)
if GetSpriteX(101)<10 then SetSpriteX(101,GetSpriteX(1)-( joystickX# )*2)

if GetSpriteY(101)>290 then SetSpriteY(101,GetSpriteY(1)-( joystickY# )*2)
if GetSpriteY(101)<10 then SetSpriteY(101,GetSpriteY(1)-( joystickY# )*2)

if GetSpriteDistance(104,101)<3 then End


rem PLAYER MOVEMENT
    joystickX# = GetVirtualJoystickX ( 1 )
    joystickY# = GetVirtualJoystickY ( 1 )

    x# = GetSpriteX ( 101 )
    y# = GetSpriteY ( 101 )

    x1# = x# - joystickX#
    y1# = y# - joystickY#

    SetSpritePosition ( 101, GetSpriteX ( 101 ) + ( joystickX# )*2, GetSpriteY ( 101 ) + ( joystickY# )*2 )


rem SPAWN ENEMIES
if counter>=300
    CreateEnemy()
    counter=1
    enemies_on=1
endif
counter=counter+1


rem CONTROL ENEMIES


if enemies_on=1
for counting=1 to 100
        enemy[counting].x# = GetSpriteX(enemy[counting].id)
        enemy[counting].y# = GetSpriteY(enemy[counting].id)
        SetSpritePosition (enemy[counting].id, enemy[counting].x#, enemy[counting].y# )
        enemy[counting].x# = enemy[counting].x# + 0.5
        enemy[counting].y# = enemy[counting].y# + 0.5
next counting
endif



 Sync()
loop

function CreateEnemy()
    count = count + 1
    if count > 99 then count = 0
    if enemy[count].id > 0
        enemy[count].x# = 240-13.5
        enemy[count].y# = 160-13.5
        SetSpritePosition(enemy[count].id, enemy[count].x#, enemy[count].y#)
    else
        enemy[count].id = createsprite( 102 )
        enemy[count].x# = 240-13.5
        enemy[count].y# = 160-13.5
        SetSpritePosition (enemy[count].id, enemy[count].x#, enemy[count].y#)
        SetSpritePhysicsOn (enemy[count].id,2)
        SetSpritePhysicsCanRotate (enemy[count].id,0)
        PlaySprite (enemy[count].id,10,1,1,10)
    endIf
endfunction


Error says, that in line 122 I cannot use sprite 0 (it is because of I used DIM, right?) and I don't know what to do..

Any help (again) would be a big thing for me

Thanks,
TP
Posted: 29th Aug 2011 17:20
Okay, I've found something weird. Why does this problem work when I make enemies be spawned by hitting mouse, but when I make it timed, it will not work.
First code (timed):
+ Code Snippet
rem
rem AGK Application
rem
rem A Wizard Didn't Do It!

menu:
SetVirtualResolution ( 480, 320 )



do
 Print("Tap something to start.")
 if GetPointerPressed()=1 then goto game
 Sync()
loop

game:

SetSyncRate( 30, 0 )

type _obj
    id
    x#
    y#
endtype


dim enemy[99] as _obj //create an array with 100 slots (0 is counted as a slot)
count = 10 //setup a count to keep track of the number of enemies created
counting = 10

SetClearColor (255,0,0)

rem PORTAL
LoadImage (103,"portal.png")
CreateSprite (103,103)
SetSpriteOffset (103,22.5,22.5)
SetSpritePosition (103,240-22.5,160-22.5)

rem DUMMY PORTAL
CreateDummySprite(104)
SetSpritePosition (104,240,160)

rem PLAYER
loadimage (101,"player2.png",1)
createsprite (101,101)
FixSpriteToScreen (101,1)
SetSpritePosition ( 101, 150, 146.5 )
SetSpriteOffset (101,13.5,13.5)
SetSpritePhysicsOn (101,2)
SetSpritePhysicsCanRotate (101,0)

rem ENEMY
LoadImage (102,"enemy.png",1)
CreateSprite (102,102)
SetSpriteAnimation (102,27,27,10)
SetSpritePosition ( 102, 50, 0 )
SetSpriteOffset (102,13.5,13.5)
SetSpritePhysicsOn (102,2)
SetSpritePhysicsCanRotate (102,0)
PlaySprite (102,10,1,1,10)

rem SCORES
score = 0
scoreText = CreateText( "Score: "+str(score))
SetTextSize (scoreText,20)


rem PHYSICS
SetPhysicsWallBottom ( 0 )
SetPhysicsWallTop ( 0 )
SetPhysicsWallLeft ( 0 )
SetPhysicsWallRight ( 0 )
SetPhysicsGravity (0,0)

rem JOYSTICK
AddVirtualJoystick ( 1, 50, 270, 10 )
SetVirtualJoystickSize (1,80)

rem VARIABLES

record#=GetSeconds()


do


rem KEEP PLAYER IN SCREEN
if GetSpriteX(101)>450 then SetSpriteX(101,GetSpriteX(1)-( joystickX# )*2)
if GetSpriteX(101)<10 then SetSpriteX(101,GetSpriteX(1)-( joystickX# )*2)

if GetSpriteY(101)>290 then SetSpriteY(101,GetSpriteY(1)-( joystickY# )*2)
if GetSpriteY(101)<10 then SetSpriteY(101,GetSpriteY(1)-( joystickY# )*2)

if GetSpriteDistance(104,101)<3 then End


rem PLAYER MOVEMENT
    joystickX# = GetVirtualJoystickX ( 1 )
    joystickY# = GetVirtualJoystickY ( 1 )

    plrx# = GetSpriteX ( 101 )
    plry# = GetSpriteY ( 101 )

    plrx1# = plrx# - joystickX#
    plry1# = plry# - joystickY#

    SetSpritePosition ( 101, GetSpriteX ( 101 ) + ( joystickX# )*2, GetSpriteY ( 101 ) + ( joystickY# )*2 )

rem SPAWN FIRST ENEMY

if ( GetSeconds() > record + 4 ) then first=1

if first=1
    CreateEnemy()
    enemies_on=1
    first=0
endif

rem SPAWN ENEMIES
if enemies_on=1
    counter=counter+1

    if counter>=100
        CreateEnemy()
        counter=1
    endif
endif


rem CONTROL ENEMIES


if enemies_on=1
for counting=10 to 100
        enemy[counting].x# = GetSpriteX(enemy[counting].id)
        enemy[counting].y# = GetSpriteY(enemy[counting].id)
        SetSpritePosition (enemy[counting].id, enemy[counting].x#, enemy[counting].y# )
        enemy[counting].x# = enemy[counting].x# + 0.5
        enemy[counting].y# = enemy[counting].y# + 0.5
next counting
endif



 Sync()
loop

function CreateEnemy()
    count = count + 1
    if count > 100 then count = 10
    if enemy[count].id > 10
        enemy[count].x# = 240-13.5
        enemy[count].y# = 160-13.5
        SetSpritePosition(enemy[count].id, enemy[count].x#, enemy[count].y#)
    else
        enemy[count].id = clonesprite( 102 )
        enemy[count].x# = 240-13.5
        enemy[count].y# = 160-13.5
        SetSpritePosition (enemy[count].id, enemy[count].x#, enemy[count].y#)
        SetSpritePhysicsOn (enemy[count].id,2)
        SetSpritePhysicsCanRotate (enemy[count].id,0)
        PlaySprite (enemy[count].id,10,1,1,10)
    endIf
endfunction


And the second code (works)(spawns when GetPointerState()=1)
+ Code Snippet
rem
rem AGK Application
rem
rem A Wizard Didn't Do It!

menu:
SetVirtualResolution ( 480, 320 )



do
 Print("Tap something to start.")
 if GetPointerPressed()=1 then goto game
 Sync()
loop

game:

SetSyncRate( 30, 0 )

type _obj
    id
    x#
    y#
endtype


dim enemy[99] as _obj //create an array with 100 slots (0 is counted as a slot)
count = 10 //setup a count to keep track of the number of enemies created
counting = 10

SetClearColor (255,0,0)

rem PORTAL
LoadImage (103,"portal.png")
CreateSprite (103,103)
SetSpriteOffset (103,22.5,22.5)
SetSpritePosition (103,240-22.5,160-22.5)

rem DUMMY PORTAL
CreateDummySprite(104)
SetSpritePosition (104,240,160)

rem PLAYER
loadimage (101,"player2.png",1)
createsprite (101,101)
FixSpriteToScreen (101,1)
SetSpritePosition ( 101, 150, 146.5 )
SetSpriteOffset (101,13.5,13.5)
SetSpritePhysicsOn (101,2)
SetSpritePhysicsCanRotate (101,0)

rem ENEMY
LoadImage (102,"enemy.png",1)
CreateSprite (102,102)
SetSpriteAnimation (102,27,27,10)
SetSpritePosition ( 102, 50, 0 )
SetSpriteOffset (102,13.5,13.5)
SetSpritePhysicsOn (102,2)
SetSpritePhysicsCanRotate (102,0)
PlaySprite (102,10,1,1,10)

rem SCORES
score = 0
scoreText = CreateText( "Score: "+str(score))
SetTextSize (scoreText,20)


rem PHYSICS
SetPhysicsWallBottom ( 0 )
SetPhysicsWallTop ( 0 )
SetPhysicsWallLeft ( 0 )
SetPhysicsWallRight ( 0 )
SetPhysicsGravity (0,0)

rem JOYSTICK
AddVirtualJoystick ( 1, 50, 270, 10 )
SetVirtualJoystickSize (1,80)

rem VARIABLES

do


rem KEEP PLAYER IN SCREEN
if GetSpriteX(101)>450 then SetSpriteX(101,GetSpriteX(1)-( joystickX# )*2)
if GetSpriteX(101)<10 then SetSpriteX(101,GetSpriteX(1)-( joystickX# )*2)

if GetSpriteY(101)>290 then SetSpriteY(101,GetSpriteY(1)-( joystickY# )*2)
if GetSpriteY(101)<10 then SetSpriteY(101,GetSpriteY(1)-( joystickY# )*2)

if GetSpriteDistance(104,101)<3 then End


rem PLAYER MOVEMENT
    joystickX# = GetVirtualJoystickX ( 1 )
    joystickY# = GetVirtualJoystickY ( 1 )

    plrx# = GetSpriteX ( 101 )
    plry# = GetSpriteY ( 101 )

    plrx1# = plrx# - joystickX#
    plry1# = plry# - joystickY#

    SetSpritePosition ( 101, GetSpriteX ( 101 ) + ( joystickX# )*2, GetSpriteY ( 101 ) + ( joystickY# )*2 )

rem SPAWN ENEMIES
if GetPointerPressed()=1
    CreateEnemy()
endif


rem CONTROL ENEMIES


if enemies_on=1
for counting=10 to 100
        enemy[counting].x# = GetSpriteX(enemy[counting].id)
        enemy[counting].y# = GetSpriteY(enemy[counting].id)
        SetSpritePosition (enemy[counting].id, enemy[counting].x#, enemy[counting].y# )
        enemy[counting].x# = enemy[counting].x# + 0.5
        enemy[counting].y# = enemy[counting].y# + 0.5
next counting
endif



 Sync()
loop

function CreateEnemy()
    count = count + 1
    if count > 100 then count = 10
    if enemy[count].id > 10
        enemy[count].x# = 240-13.5
        enemy[count].y# = 160-13.5
        SetSpritePosition(enemy[count].id, enemy[count].x#, enemy[count].y#)
    else
        enemy[count].id = clonesprite( 102 )
        enemy[count].x# = 240-13.5
        enemy[count].y# = 160-13.5
        SetSpritePosition (enemy[count].id, enemy[count].x#, enemy[count].y#)
        SetSpritePhysicsOn (enemy[count].id,2)
        SetSpritePhysicsCanRotate (enemy[count].id,0)
        PlaySprite (enemy[count].id,10,1,1,10)
    endIf
endfunction


I wouldn't say that this is a bug, it is that I just don't get it or something. Anyone had this kind of thing with DBPro or AppGameKit or something else? A little help would be a great help for me.

Thanks,
TP
Posted: 29th Aug 2011 18:19
A quick look and I noticed you have record, and record#, are they meant to be the same? That would certainly cause issues.
Posted: 30th Aug 2011 16:45
DVader, thanks. Now fixed. But I found out what is my problem now.
I am calling my "enemies" in a wrong way for "for - to - next" loop. I tried to fix by many ways but I didn't manage to fix it. There is something wrong in my head, I don't get this somehow...

Enemies can spawn, yeah I figured that out, but I don't know what exaclty should I use in for to next loop to handle my sprites.
+ Code Snippet
rem
rem AGK Application
rem
rem A Wizard Didn't Do It!

menu:
SetVirtualResolution ( 480, 320 )



do
 Print("Tap something to start.")
 if GetPointerPressed()=1 then goto game
 Sync()
loop

game:

SetSyncRate( 30, 0 )

type _obj
    id
    x#
    y#
endtype


dim enemy[99] as _obj //create an array with 100 slots (0 is counted as a slot)
global count = 1 //setup a count to keep track of the number of enemies created
counting = 1

SetClearColor (255,0,0)

rem PORTAL
LoadImage (103,"portal.png")
CreateSprite (103,103)
SetSpriteOffset (103,22.5,22.5)
SetSpritePosition (103,240-22.5,160-22.5)

rem DUMMY PORTAL
CreateDummySprite(104)
SetSpritePosition (104,240,160)

rem PLAYER
loadimage (101,"player2.png",1)
createsprite (101,101)
FixSpriteToScreen (101,1)
SetSpritePosition ( 101, 150, 146.5 )
SetSpriteOffset (101,13.5,13.5)
SetSpritePhysicsOn (101,2)
SetSpritePhysicsCanRotate (101,0)

rem ENEMY
LoadImage (102,"enemy.png",1)
CreateSprite (102,102)
SetSpriteAnimation (102,27,27,10)
SetSpritePosition ( 102, 50, 0 )
SetSpriteOffset (102,13.5,13.5)
SetSpritePhysicsOn (102,2)
SetSpritePhysicsCanRotate (102,0)
PlaySprite (102,10,1,1,10)

rem SCORES
score = 0
scoreText = CreateText( "Score: "+str(score))
SetTextSize (scoreText,20)


rem PHYSICS
SetPhysicsWallBottom ( 0 )
SetPhysicsWallTop ( 0 )
SetPhysicsWallLeft ( 0 )
SetPhysicsWallRight ( 0 )
SetPhysicsGravity (0,0)

rem JOYSTICK
AddVirtualJoystick ( 1, 50, 270, 10 )
SetVirtualJoystickSize (1,80)

rem VARIABLES
record#=GetSeconds()

do


rem KEEP PLAYER IN SCREEN
if GetSpriteX(101)>450 then SetSpriteX(101,GetSpriteX(1)-( joystickX# )*2)
if GetSpriteX(101)<10 then SetSpriteX(101,GetSpriteX(1)-( joystickX# )*2)

if GetSpriteY(101)>290 then SetSpriteY(101,GetSpriteY(1)-( joystickY# )*2)
if GetSpriteY(101)<10 then SetSpriteY(101,GetSpriteY(1)-( joystickY# )*2)

if GetSpriteDistance(104,101)<3 then End


rem PLAYER MOVEMENT
    joystickX# = GetVirtualJoystickX ( 1 )
    joystickY# = GetVirtualJoystickY ( 1 )

    plrx# = GetSpriteX ( 101 )
    plry# = GetSpriteY ( 101 )

    plrx1# = plrx# - (joystickX#+4)
    plry1# = plry# - (joystickY#+4)

    SetSpritePosition ( 101, GetSpriteX ( 101 ) + ( joystickX# )*2, GetSpriteY ( 101 ) + ( joystickY# )*2 )


rem SPAWN FIRST ENEMY

if ( GetSeconds() > record# + 2 ) then first=1

if first=1
    CreateEnemy()
    enemies_on=1
    record#=Timer()
    first=0
endif

rem SPAWN ENEMIES
if enemies_on=1
    if ( GetSeconds() > record# + 2 )
        CreateEnemy()
        record#=Timer()
    endif
endif


rem CONTROL ENEMIES


if enemies_on=1
for counting=1 to 100
        enemy[counting].x# = GetSpriteX(enemy[counting].id)
        enemy[counting].y# = GetSpriteY(enemy[counting].id)
        SetSpritePosition (enemy[counting].id, enemy[counting].x#, enemy[counting].y# )
        enemy[counting].x# = enemy[counting].x# + 0.5
        enemy[counting].y# = enemy[counting].y# + 0.5
next counting
endif



 Sync()
loop

function CreateEnemy()
    count = count + 1
    if count > 100 then count = 1
    if enemy[count].id > 1
        enemy[count].x# = 240-13.5
        enemy[count].y# = 160-13.5
        SetSpritePosition(enemy[count].id, enemy[count].x#, enemy[count].y#)
    else
        enemy[count].id = clonesprite( 102 )
        enemy[count].x# = 240-13.5
        enemy[count].y# = 160-13.5
        SetSpritePosition (enemy[count].id, enemy[count].x#, enemy[count].y#)
        SetSpritePhysicsOn (enemy[count].id,2)
        SetSpritePhysicsCanRotate (enemy[count].id,0)
        PlaySprite (enemy[count].id,10,1,1,10)
    endIf
endfunction


Sorry if I sound like stupid or something, I just don't get this thing...

Thanks,
TP
Posted: 30th Aug 2011 17:09
I'd suggest setting your global count variable to 0. The first thing you do in your CreateEnemy function is increment that variable, so your first enemy is actually 'enemy[2]'.

The next thing you need to do is change your CONTROL ENEMIES code as follows:
+ Code Snippet
if enemies_on=1
for counting=1 to count
        enemy[counting].x# = GetSpriteX(enemy[counting].id)
        enemy[counting].y# = GetSpriteY(enemy[counting].id)
        enemy[counting].x# = enemy[counting].x# + 0.5
        enemy[counting].y# = enemy[counting].y# + 0.5
        SetSpritePosition (enemy[counting].id, enemy[counting].x#, enemy[counting].y# )
next counting
endif

Note the subtle difference. Instead of having your counting variable increasing from 1 to 100 (which will give you errors if you only have one enemy sprite to start with), you have it go from 1 to 'count'. That way you will only update the enemy elements that are valid.

You also need to move your SetSpritePosition command to underneath the lines that update the enemy position.

Give that a go and let us know how you get on.
Posted: 30th Aug 2011 18:46
Bursar - you just solved my problem! Very, very big thanks to you, and all who helped me! It is working now!
I understood what I did wrong now. Changed it and PAF - it works. Now that code isn't very cool yet, but my current version is way more better now, this problem was a big barricade for me.
You may hear something of SuperDodge some day at the forums or so


Big thanks!
TP
Posted: 30th Aug 2011 18:53
Excellent news. Now go make a cool game