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 / A sprite dont exist even when Ive created it. Why???

Author
Message
Mr X
19
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 24th Apr 2006 21:06
Hi.

Im having trubble with my code. The problem seems to be that a sprite wont exist, even after Ive created it. You see, when I try to compile the program, it complains about that sprite. And I dont know whats wrong. It didnt complain before. And I KNOW Im using the function to create the sprite before I use the function to move it (which is where the compiler stops). Take a look at the functions called \"MovementPlayerOne()\" and \"MovementPlayerTwo()\". You can also take a look at the function called \"MakeShips()\". And pleace tell me if you know why it wont work.

The end is near
19
Years of Service
User Offline
Joined: 19th Jun 2005
Location: USA
Posted: 25th Apr 2006 04:10
next time can you just give me the part with the error!?!

stargate sg-1 the one show that never gets old
Mr X
19
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 25th Apr 2006 13:25
Its the
part, when I check the ships positions the compiler complains that the sprite wont exist. The thing is that I think I know what the problem is (a virus that has screwed up my compiler several times before), but I wanted to be sure that it wasnt an coding error.
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 25th Apr 2006 14:27
Don't blame sloppy coding on a virus!

Your main problem is you need to move your global definitions to top of program as they zap any values you have already assigned to them, so your 'menu' variable you think is 1 to start with, is actually 0, so it tries to play game without going through main menu.



Boo!
Mr X
19
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 25th Apr 2006 16:54
THAT was something Ive not thought of (didnt even know it). Thanks, Ill test that tomorrow (havent time today).

Quote: "Don't blame sloppy coding on a virus! "


I have had problem with that virus before. Thats why I thought it was the it again. And I asked that time to, but the code work for everyone else. Just not me . And it still wont work after re-installing DarkBASIC, so I started the current project. Thats the reason I thought it was the virus.
mbaucco
19
Years of Service
User Offline
Joined: 6th Nov 2005
Location:
Posted: 25th Apr 2006 20:37
Not sure if this is the same problem, but I have been going through the tutorials in the "Beginner's Guide to DarkBasic Game Programming" and have not been able to get sprites to appear. I even ran the demo program off the cd that came with the book and the same thing happens.

-Matt
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 25th Apr 2006 22:10
Please don't butt into other peoples posts. If you have a problem post a new thread with a compilable code snippet showing the problem.

Boo!
mbaucco
19
Years of Service
User Offline
Joined: 6th Nov 2005
Location:
Posted: 25th Apr 2006 23:33
I was just pointing out that the problem may not be sloppy coding. I was not asking for help or "butting in".

-M
Mr X
19
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 26th Apr 2006 13:28
It worked. Thanks.

And mbaucco, its not the same problem. My compiler sometimes just go crazy, once it called a function for an unknown command (that was the problem I spoke of before).
Mr X
19
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 26th Apr 2006 15:32
Damn. Ive got the sprite part to work, but now one of the functions wont work. It complains that its an unknown command. And I dont know why (this time I dont blame the virus).

The subrutine in which the function is used (all the other ones work):


And the function itself:


Does anyone have an idea about whats wrong?
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 26th Apr 2006 16:52
What editor are you using, default, blue IDE, etc

I would guess that the REM on line 1 of that code snippet could be to blame because it ends in ... which some editors use as a special concatanation symbol to join multiple lines together.

Boo!
Mr X
19
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 26th Apr 2006 19:04
That did the trick , thank you. And I guess that was the problem before in my other program (so it mayby wasnt the virus!). Thanks again.

And I use the defult editor.

Login to post a reply

Server time is: 2024-11-27 20:36:56
Your offset time is: 2024-11-27 20:36:56