INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• 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.

# MOVING SPRITE HELP!!!

## MOVING SPRITE HELP!!!

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

get image 1,0,0,69,71
get image 2,0,0,53,36
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.

#### 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.

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:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!