Page 1 of 1

Linked List Help Please

Posted: Fri Jun 30, 2006 12:25 am
by SoulReaper
Hello There :)

I seem to have had a little problem and was wondering is there a very kind person out there that could tell me where I am going wrong the code below use to work on 3.94 but its no go on v4.00

I have looked but I just cant see where the problem is...

Thankyou in advance :wink:
Kevin

Code: Select all


Structure enemy    
  x.f
  y.f
  SpeedX.f
  SpeedY.f
  InertiaX.f
  InertiaY.f
  MaxInertiaX.f
  MaxInertiaY.f
  InertialVelocityX.f
  InertialVelocityY.f
  Armor.b

; needed to let alien be created offscreen without dying
    OnScreen.b

; needed for pattern control on each alien
    Pattern_Number.b
    Pattern_Offset.w
    pattern_counter.w

EndStructure 
NewList Enemy.enemy()


Procedure AddEnemy(x, y, SpeedX, SpeedY, Armor)
  AddElement(Enemy())  ; Not a function, array or linked list em.....
  Enemy()\x = x
  Enemy()\y = y
  Enemy()\SpeedX = SpeedX
  Enemy()\SpeedY = SpeedY
  Enemy()\Armor = Armor 
EndProcedure

P.S. I am not to great with Link Lists LOL :oops: :lol: :wink:

Posted: Fri Jun 30, 2006 12:40 am
by netmaestro
Global NewList Enemy.enemy()

3.9x linklists and arrays were all global but in v4 their scope is treated as any other variable - you must specify the scope.

Another approach you can use in v4 is to pass the linklist as parameter to the procedure if you don't want to make it global. Lots more options with this new version!

Posted: Fri Jun 30, 2006 1:20 am
by SoulReaper
Thankyou for your quick reply :)

I am getting there with pure basic version 4 :wink: There is just soo much to learn :shock: :lol: :twisted: :wink:

Best Regards
Kevin :wink: