Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / help with arrays and dim

Author
Message
lokatsis
20
Years of Service
User Offline
Joined: 11th Feb 2004
Location: greece
Posted: 21st Jun 2004 19:52
hi im sending this mail because i d like to help me with my game on how using dims to multiply my enemies and shoot them.
its a space game
here is a piece of code of my game so you can help me better



sync on
sync rate 30

load image "you",1
load image "enemy",2
load image "bullet",4

ysx=290:ysy=420
sprite 1,ysx,ysy,1
lx=SPRITE X(1)+20
ly=SPRITE Y(1)+10
ax=400
ay=100
sprite 3,ax,ay,2
pf=0

do
if leftKEY()=1 and ysx>60
dec ysx,10
endif
if rightKEY()=1 and ysx<530
inc ysx,10
endif
if inkey$()="z" and pf=0 then gosub shoot:pf=1
if SPRITE EXIST(2)=1
if SPRITE EXIST(1)=1
if SPRITE HIT(2,3)=1 then gosub blowitup
endif
endif
sprite 1,ysx,ysy,1
gosub moveall

sync
loop


moveall:
if SPRITE EXIST(2)=1
If sprite y(2)>(-35)
ly=ly-45
sprite 2,lx,ly,4
endif
endif
if SPRITE EXIST(2)=1
If sprite y(2)<(-35)
pf=0
hide sprite 2
lx=SPRITE X(1)+20
ly=SPRITE Y(1)-10
endif
endif
return
shoot:
if SPRITE EXIST(2)=1
show sprite 2
endif
sprite 2,lx,ly,4

return

blowitup:
delete sprite 2
delete sprite 3
return



this code only has one enemy but i want to multiply them to 10 and when i shoot and the bullet hits an enemy sprite the specific sprite to be deleted
i hope that you can help to create them using arrays thanks

THE AOOS

Login to post a reply

Server time is: 2024-09-22 14:29:10
Your offset time is: 2024-09-22 14:29:10