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 / Brickbreak

Author
Message
n008
17
Years of Service
User Offline
Joined: 18th Apr 2007
Location: Chernarus
Posted: 11th May 2007 00:35
I'm making a brickbreak game and have about 30 objects, I know how to make the brick disapear when the ball hits it, but is their an easier way to store the variables for the bricks?

Ling creckt tsi nocreckto havela? NASA chetallnar mo lu'ul nasding!
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 11th May 2007 02:39 Edited at: 11th May 2007 02:39
Quote: "is their an easier way to store the variables for the bricks?"


Surely that depends on what you are currently using now - and you didn't tell us! You can't beat arrays.

TDK_Man

n008
17
Years of Service
User Offline
Joined: 18th Apr 2007
Location: Chernarus
Posted: 11th May 2007 02:56
oops


Ling creckt tsi nocreckto havela? NASA chetallnar mo lu'ul nasding!
n008
17
Years of Service
User Offline
Joined: 18th Apr 2007
Location: Chernarus
Posted: 11th May 2007 02:56
that is my code so far

Ling creckt tsi nocreckto havela? NASA chetallnar mo lu'ul nasding!
Gil Galvanti
19
Years of Service
User Offline
Joined: 22nd Dec 2004
Location: Texas, United States
Posted: 11th May 2007 04:34
I'll try to help you, but I'm not sure what your trying to do. Right now you just have a sphere deflecting off of the paddle and walls, what do you want that sphere to do, and what boxes do you want to disappear? Also, why do you have 18 boxes and are positioning many of them in the same position or overlapping?


n008
17
Years of Service
User Offline
Joined: 18th Apr 2007
Location: Chernarus
Posted: 11th May 2007 04:44
no, they are just close, not overlapping, and what i want to happen is when the sphere hits a cube, for it to disapear.

Ling creckt tsi nocreckto havela? NASA chetallnar mo lu'ul nasding!
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 11th May 2007 05:04
Just as a little pointer, you need to urgently discover For...Next loops and Data statements!

There are also some pretty glaring basic errors in your code - but that will sort itself out in time. At first glance however, it doesn't look like your snippet would even run as you've posted it!

I think I've told you before that you need to read a few tutorials and get a good understanding of the fundamental stuff - if that is you want to become a decent programmer.

We all started like you, so you're no different to anyone else was when they first started. So, pointing out where you have gone wrong shouldn't be taken as criticism - just friendly advice.

1. Indent your code.

2. Learn about procedural coding and use a proper layout for your code.

3. Stop stacking code lines in such an unorthodox manner. It's not the 20 line code challenge and how you are doing it makes it very hard to read and apply indentation correctly.

In your program:

Turn Sync on before you set the Sync Rate.

What does this do?

balla#=wrapvalue(balla#)

The preceding line has a solitary If on it so maybe it should say:

if balla#=wrapvalue(balla#)

but that makes no sense either... and I can't find any associated Endif to go with it.

Here's your code with a few amendments to help you on your way. I'm not saying it will run yet though...



Once again though, I seriously recommend that you check out the tutorials for beginners that cover program layout and style because if you don't, your programs as they get bigger and bigger will become harder and harder to follow and debug.

As it is, this one of yours is starting to give me a headache!

Good luck...

TDK_Man

n008
17
Years of Service
User Offline
Joined: 18th Apr 2007
Location: Chernarus
Posted: 12th May 2007 01:07
Thanks, but what do the data strings do?

Ling creckt tsi nocreckto havela? NASA chetallnar mo lu'ul nasding!
Daemon
18
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 12th May 2007 01:11
Every time "read" is used it gets the next thing in the list of data and sets the variable after "read" to this.

n008
17
Years of Service
User Offline
Joined: 18th Apr 2007
Location: Chernarus
Posted: 12th May 2007 01:31
ok, but it says the loop command is out of place, what happened?

Ling creckt tsi nocreckto havela? NASA chetallnar mo lu'ul nasding!
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 12th May 2007 01:38 Edited at: 12th May 2007 01:38
Quote: "ok, but it says the loop command is out of place, what happened?"


I covered that in my post:

Quote: "What does this do?

balla#=wrapvalue(balla#)

The preceding line has a solitary If on it so maybe it should say:

if balla#=wrapvalue(balla#)

but that makes no sense either... and I can't find any associated Endif to go with it."


I did say it probably wouldn't run for that reason.

TDK_Man

n008
17
Years of Service
User Offline
Joined: 18th Apr 2007
Location: Chernarus
Posted: 12th May 2007 01:53
but Balla# is a variable!

Ling creckt tsi nocreckto havela? NASA chetallnar mo lu'ul nasding!
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 12th May 2007 03:51
I know.

What I mean is "what is that line supposed to be doing"?

balla#=wrapvalue(balla#)

is like saying

100 = 100

if balla# was 200 then that line would mean:

200 = 200

There's no point in it.

Even if it should say:

if balla#=wrapvalue(balla#)

then balla# will always equal wrapvalue(balla#), so there's equally no point in it.

However, in the second case, as you've made it an If, there has to be an Endif - and I don't see one.

And that in DB can show up as an out of place loop error as DB treats all start and end blocks as the same. Occasionally it can get confused and say that the wrong type of block hasn't been terminated correctly.

TDK_Man

n008
17
Years of Service
User Offline
Joined: 18th Apr 2007
Location: Chernarus
Posted: 12th May 2007 05:43
Actually, it doesn't do anything

Ling creckt tsi nocreckto havela? NASA chetallnar mo lu'ul nasding!

Login to post a reply

Server time is: 2024-11-25 17:38:33
Your offset time is: 2024-11-25 17:38:33