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.

2D All the way! / very odd. code supplied.

Author
Message
Snafu
22
Years of Service
User Offline
Joined: 25th Jun 2003
Location:
Posted: 6th Jul 2004 08:57
can someone take a look at this code and tell me what on earth is happening?

Every time I try to run the program it bombs out.

My main project file contains:


#include init.dba
#include graphics.dba
#include spritemovement.dba
#include gameloop.dba


init.dba at the moment simply sets the resolution
graphics.dba loads the appropriate images

those two i can confirm work fine.

here's the contents of spritemovement.dba


and here's the contents of gameloop.dba


As you can see it's in very early stages.. but.. what the f**k?

btw there is NOTHING in the other two .dba files causing this problem. putting a rem before the #include spritemovement.dba makes the 'game' run.

- Steve
ToXic
23
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Australia
Posted: 6th Jul 2004 09:25 Edited at: 6th Jul 2004 09:28
The only thing with your code that I can see is the variables
xpos,ypos will not be updated with the function, or any changes
made with the function will be reset with xpos,ypos.




ToXic.
zenassem
23
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 6th Jul 2004 10:20 Edited at: 6th Jul 2004 10:24
So far I have spotted this:

In the first snippet you are passing in SP_Number

but indside the function you are using:
sp_number

You need to change the case. (change sp_number to SP_Number)

Reason
sp_number does not equal SP_Number

sp_number in your code would always=0 which you do not have as a valid sprite number.

~Zen


Snafu
22
Years of Service
User Offline
Joined: 25th Jun 2003
Location:
Posted: 6th Jul 2004 11:22
Toxic, noted - but if you look you'll see that I was only looking to play with one key at the time. f_spritemove would never have been used because of:

[QUOTE]
REM if leftkey()=1 then f_spritemove(1,"left",1)
if rightkey()=1 and xpos < 690 then xpos=xpos + 1
[/QUOTE]

it's rem'd out while I was testing to see what was causing the program to just bomb out.

the program will not even stay on my screen for longer than a second now. It's as though it gives up when it tries to load the spritemove.dba file.

Zenassem: Thanks - I had no idea they were case sensitive.

- Steve
Snafu
22
Years of Service
User Offline
Joined: 25th Jun 2003
Location:
Posted: 6th Jul 2004 11:50
ok uh

my DB project closes when I use the 'function' command.

any ideas at all?
zenassem
23
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 6th Jul 2004 11:57
hmmm.

Everything looks ok.

try removing "_'s" (underscores) from your function names?

I had a problem with them

DBC or DBpro?

If dbpro
Is the function showing up in the IDE when you click on the functions button?
Are you using the latest ide 1.92b (i think?), it's seperate from the pathc updates?
Are you using the latest patch 5.4?
Are you using a 3rd party editor or the buit-in IDE (eg blueGUI, Twilight)

if DBC?
is it 1.13 enhanced?
are you using the default ide or a 3rd party? (eg DarkEdit, Codekeeper)

~Zen


Snafu
22
Years of Service
User Offline
Joined: 25th Jun 2003
Location:
Posted: 6th Jul 2004 12:04
btw, when I say 'project' I mean - compiled executable.

Im not doing well with this english language business tonight, such are the pains of 3am....

try removing "_'s" (underscores) from your function names?
Still bombs out even without those

dbpro

Is the function showing up in the IDE when you click on the functions button?
Yes.

Are you using the latest ide 1.92b (i think?), it's seperate from the pathc updates?
I wasn't. now I am, it still does the same.

Are you using the latest patch 5.4?
indeed I am.

are you using a 3rd party editor or the buit-in IDE (eg blueGUI, Twilight)
built in and notepad.

"function" causes my project to refuse to run and without that, DBPro is useless to me

- Steve
zenassem
23
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 6th Jul 2004 12:13 Edited at: 6th Jul 2004 12:18
Strange,

I can tell you for certain that the adjusted code snippet that toxic provided works 100% for me.

2 red boxes, input control, pretty close to pixel perfect collision.

So will his code snippet run for you?
(the one where the function is in the 1 .dba file)

Any other code give you a problem. Because then i could see it being a video card driver not up to the latest patch. Sprites in DBpro are flat 3d plains. But if that were the case you would have seen problems with other sprite code, not just functions.

Does the code work if you pull everything out of the function?
If that's the case you may need to repair your 5.4 install. People have had problems with it.

Btw, I think I saw someone else have problems with functions after 5.4 upgrade i just can't remember if it's in the Newcomers or DBpro board. I'm going to go look for it to see if it's the same thing that is happening to you.

Be back in a few minutes.

We'll get this sorted out.

~zen


ToXic
23
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Australia
Posted: 6th Jul 2004 15:01
Have you tried to add the files using the files button on the
right of the editor, I think if you do this there is no need for the
#include command. but as Zen has said if my code will not run for you, re-install and start again.


ToXic.
Snafu
22
Years of Service
User Offline
Joined: 25th Jun 2003
Location:
Posted: 6th Jul 2004 19:23
No. As stated, the function command is causing my project to close. Even this simple little line anywhere in a project causes it to close.

function shiznit()
endfunction

Thanks Zen. I did have a quick search through but couldn't find anything relevant.

- Steve
zenassem
23
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 6th Jul 2004 22:32
Snafu,

Looks like we hit a "Snafu"! Very omniscient.

You might want to e-mail rich about this problem. I haven't seen this problem before.

It looks like you might need to re-install patch 5.4 using repair. If that doesn't work, you might have to remove DBpro ad reinstall it from scratch and then patch up to 5.4.

~Zen


Login to post a reply

Server time is: 2026-06-09 19:41:05
Your offset time is: 2026-06-09 19:41:05