INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

MOVING SPRITE HELP!!!

MOVING SPRITE HELP!!!

(OP)
`Set up
constant1 = 2
hide mouse
randomize timer()

`Loading bitmaps and getting images
load bitmap "airplanesprite.bmp", 0
get image 1,0,0,69,71
load bitmap "alienshipsprite.bmp", 0
get image 2,0,0,53,36
load bitmap "bullet.bmp", 0
get image 3,0,0,12,12
cls

`Declare variables [TO DO]
dim spritenum(constant1)
for n = 1 to constant1
   spritenum(n)=n+2
next n
spriteplace = 1
shipx = 0
shipy = 0
alientime = 0
alienships = 0
counter = 1

`Start the game
cls
print "Press any key to begin."
wait key
cls
sprite 1,500,240,1

`Game loop
do

   `Creating a new alien ship
   if alientime = constant1
      k=spritenum(spriteplace)
      wait key
      sprite k,0,rnd(480),2
      rotate sprite spritenum(spriteplace), 270
      alienships = alienships + 1
      spriteplace = spriteplace + 1
      wait 500
   endif

   wait key

   `Moving all alien ships
   if alienships > 0
      for n = 0 to alienships
         move sprite spritenum(counter), 10
         counter = counter + 1
      next n
   endif

   `Sorting out variables
   counter = 1
   shipx = sprite x(1)
   shipy = sprite y(1)
   if alientime >= constant1 then alientime = 0
   alientime = alientime + 1

   `Shooting
   if spacekey() = 1
      sprite 2,shipx,shipy,3
      rotate sprite 2, 90
      move sprite 2, 15
   endif

loop

wait key
end

-----------------------------------------------------------

This is my unfinished game. The problem is, when i go to move all alien ships, and command it to use index 1 in the spritenum array, it tells me that the sprite does not exsist.
Copy it into DBPRO yourself if you want.
Please help!!!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close