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 / Sprite not recognized because... it's blue?

Author
Message
Cairne
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location: The Internet
Posted: 6th Jun 2005 13:12
I'm working on a game and making a lot of progress, however I have encountered a slight snag, my "I'm too lazy to draw" flat red ground and flat red circle sprite function fine, however, when I change the flat red circle to a "I'm too lazy to draw" flat blue triangle as part of a weapon change feature, the sprite stops responding to the ground it's placed on. I've tried everything, and the only thing that works is... changing the color of the triangle to red. Any idea what is going on? I've attached my code...
here.

The world would be a far better place when people stop posting "I need help" as their thread title. If you want your question answered quickly, we need to know your problem quickly!
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 6th Jun 2005 20:47 Edited at: 6th Jun 2005 20:47
I'm not sure exactly what the problem is but.

1. Try not to use goto unless you have to. Use functions or gosubs to group blocks of code you want to reuse.



Using gosubs, funtions or loops groups blocks of code together and makes it easier to keep organised. With goto it's easy to end up with code that jumps all over the place and is very difficult to follow and debug.

2. Assign images numbers and load them all outside the game loop.


I suspect this is what is causing your problem. Sprite 2 has image no 101. In the weapon change bit you delete image 101. Sprite 2 no has no image which may cause the problem.
If you have the images loaded you just need to swap the sprites image number.
Either by using the sprite command


Or store the image number in a variable



dbhelp - online dbpro help files with user comments
Cairne
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location: The Internet
Posted: 7th Jun 2005 07:21
Honestly, I taught myself darkbasic and have never used gosub before, so it's all pretty confusing to me. I'll try to take your advice though, thanks for the help.

The world would be a far better place when people stop posting "I need help" as their thread title. If you want your question answered quickly, we need to know your problem quickly!

Login to post a reply

Server time is: 2024-09-23 21:15:12
Your offset time is: 2024-09-23 21:15:12