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.

Author
Message
someone namedlink
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: Dream Planet
Posted: 7th Aug 2004 21:15
hello,

I encountered a strange problem in DBP. the problem is the following:
I have an array cards01(60) and all the data in the array is 0.
then I have cards on the screen numbered from 1 to 102. sprite 1001 is the sprite for the mouse. so when I do this:

c=0
for t=1 to 60 step 1
if sprite collision(1001,0)==cards01(t)
c=c+1
endif
next t

so I count how much that card I standing on is in the deck. all the cards should be 0 times in the deck as I did not add any. and for the cards 2 to 102 it is correct. But for the card 1 it is not.

I printed out the values so I could see what was happening and he gave this:

1=0
c=60
?????

so since when is 1=0???? is this a bug in the program are is it something else? I can't see it

DIV/DBP-coder
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 7th Aug 2004 21:38 Edited at: 7th Aug 2004 21:39
Okay,
Personally, I'd remove the == from the equation, but that's just me... = is enough imho.

Now as for the problem, sprite collision (num,0) returns the obejct hit, or ZERO if nothing. If any value in the card01() array is zero, it will be counted as a hit by that code.
S.

Any truly great code should be indisguishable from magic.
someone namedlink
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: Dream Planet
Posted: 8th Aug 2004 01:06
ok, thx,

the == was the problem. but I used to write in that way because almost every programming language uses this. = is different from ==.

DIV/DBP-coder
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 8th Aug 2004 08:13
Ah yes, know that one myself...
S.

Any truly great code should be indisguishable from magic.

Login to post a reply

Server time is: 2024-09-22 20:26:03
Your offset time is: 2024-09-22 20:26:03