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 / [DBPro] Object Number Illegal Error

Author
Message
meesta plunk
18
Years of Service
User Offline
Joined: 17th May 2006
Location:
Posted: 14th Jun 2006 18:19
So in my game when you run ou tof ammo you have to pick up one of the ammo crates lying on the ground. Problem though, the collision code between you (the player) and the ammo crates doesn't work. DarkBASIC gives me the error 'Object number illegal'. I have no idea what's wrong. Here's my code:

Make Ammo Crates:


Now, that code works fine. The objects are created, colored, and placed randomly on the matrix.

Collisiion with Crates:


Thanks!
Daemon
18
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 14th Jun 2006 19:11
Can I see your full code?

The only thing I could guess from seeing the code you have posted is that you may have forgot to make player# equal something other than 0.

Insanity is just a state of mind
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 14th Jun 2006 19:49
Also you should not use 'float' variables for object numbers, use integers only

Boo!
Crit
18
Years of Service
User Offline
Joined: 24th May 2006
Location:
Posted: 14th Jun 2006 23:32
number_crates = 5

you should be looping from 101 to 105

or even better:


spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 14th Jun 2006 23:45
Well spotted! Should have seen that a mile off.

Boo!
Daemon
18
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 15th Jun 2006 00:52 Edited at: 15th Jun 2006 00:53
Wow, something so simple. They always are the most difficult to figure out.

Insanity is just a state of mind
meesta plunk
18
Years of Service
User Offline
Joined: 17th May 2006
Location:
Posted: 15th Jun 2006 20:42
Uhh, that doesn't work either. By the way, I think I posted that code wrong because I opened my project today and the numbers in the 'for' statements were different hten what I posted.

Here's my full code.
meesta plunk
18
Years of Service
User Offline
Joined: 17th May 2006
Location:
Posted: 19th Jun 2006 15:03
Got it! In the for loop that checks for collision with an ammo crate, I used 'player#' instead of 'player' - problem solved.

Login to post a reply

Server time is: 2024-09-25 01:24:34
Your offset time is: 2024-09-25 01:24:34