Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Help with dark basic game

This topic is 5305 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m making a simple space shooter game in dark basic for college. I don''t really know the langauge and i''m not really very good at programming full stop but its gotta be done. I''m having problems with a sprite collision. I thought the sprite number for the bullet would be x but it ain''t when i create the sprite collison the enemy collides with the ship not the bullets. Also can anyone tell me how i can create an array of enemies without it conflicting with my array of bullets. I tried this but couldn''t do it because it was the loop was running from 1 to 10 and when i was trying to create the sprite it was using the numbers 1 to 10 which are already being used. Exscuse the code i know its really awful but right now i''m just trying to get the basics down. num# = 1 SYNC ON SYNC RATE 50 count=0 shootagain$="y" dim bullet(100) dim bulletx(100) dim bullety(100) enemyx# = RND(620) enemyy# = -50 Cls Load Image "ship.bmp",1 Load Image "bullet.bmp",2 Load Image "enemy.bmp", 3 dim fired$(100) for x = 1 to 100 fired$(x) = "N" next x Repeat Cls Sprite 101, shipx#, shipy#, 1 If Rightkey()= 1 then shipx#=shipx#+3 If Leftkey()= 1 then shipx#=shipx#-3 If Upkey()= 1 then shipy#=shipy#-3 If Downkey()= 1 then shipy#=shipy#+3 Sprite 103, enemyx#, enemyy#, 3 enemyy# = enemyy# + 1 If spacekey()= 1 and shootagain$="y" for x = 1 to 100 if fired$(x) = "N" fired$(x) = "Y" shootagain$="n" count=0 bulletx(x) = shipx# + 20 bullety(x) = shipy# exit endif next x endif for x = 1 to 100 if bulletx(x) < -20 or bulletx(x) > 660 or bullety(x) < -20 or bullety(x) > 500 fired$(x) = "N" endif If fired$(x) = "Y" Sprite x, bulletx(x), bullety(x), 2 bullety(x) = bullety(x) - 8 endif next x if shootagain$="n" count = count + 1 if count = 10 shootagain$="y" endif endif if sprite collision(x,103)>0 enemyy# = -50 endif sync Until num# = 0

Share this post

Link to post
Share on other sites
Haven’t used DarkBasic for too long to be much help with specifics, but. your line

if sprite collision(x,103)>0

does not define x within a valid range.

You use x in a for loop, but do the test after leaving it without leaving prematurely, so x will have the value of the loop limit + 1.

If you need anything further, you will have to help us by explaining what these sprite commands do. I abandoned DB 3 years ago and have no wish to re install it.

Are there no forums for Darkbasic anymore? That would be the logical first step for getting help.


Don''t follow me, I''m lost.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!