structures

Mark Wieder mwieder at ahsoftware.net
Mon Mar 8 17:29:07 EST 2004


Marty-

Monday, March 8, 2004, 9:29:40 AM, you wrote:

MB> For example, one of my students wants to create an array
MB> of bullets for his video game.  For each bullet we need to
MB> know the following:
MB>  - its current availability (already in use, or available)
MB>  - its movement in the x direction if in use
MB>  - its movement in the y direction if in use

Does something like this work for you?

global gBullets
global bIsAvailable, deltaX, deltaY

on mouseUp
  SaveBulletAttributes "bullet1"
end mouseUp

on SaveBulletAttributes whichBullet
  put bIsAvailable into gBullets(whichBullet, "availability")
  put deltaX into gBullets(whichBullet, "xMovement")
  put deltaY into gBullets(whichBullet, "yMovement")
end SaveBulletAttributes

on GetBulletAttributes whichBullet
  put gBullets(whichBullet, "availability") into bIsAvailable
  put gBullets(whichBullet, "xMovement") into deltaX
  put gBullets(whichBullet, "yMovement") into deltaY
end GetBulletAttributes

-- 
-Mark Wieder
 mwieder at ahsoftware.net



More information about the use-livecode mailing list