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.

DarkBASIC Discussion / DarkNOOBS Project 4: Breakout

Author
Message
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 17th Jul 2009 21:57
ok what if we did something like this:

we make two images, put the black stuff into one and the red into the other

once either is collided then we use inequalities to check which of the four possible directions are likely, then adjust either one or both of the movement variables (depending on if it was a corner or side collision)

sorry if the image turns out weird

Attachments

Login to view attachments
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 17th Jul 2009 22:02 Edited at: 17th Jul 2009 22:02
My method was to check the difference between the centers of the ball and the colliding brick in both the x and y direction. I then subtracted half of the brick size in each direction from the difference. You can then check to see if the ball is hitting the top/bottom or the right/left. I never fully developed it, but it seemed to work pretty well.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 17th Jul 2009 22:56
so if:

ballx>(bricks left side) and ballx<(bricks right side)

and

bally>=(brickcy)-(.5*16)-(.5*10)

then

top collision?

eh worth a try, Ill hop to coding


IS ANYONE ELSE WORKING!?!?!?!

IF YOU ARENT SURE OF YOUR PART JUST ASK, WE NEED PEOPLE WORKING!!

BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 17th Jul 2009 23:07
I don't know how many people are left Ashingda left a while back, not sure who else was part of it though.

Just to clarify the math:

If the brick is 30 pixels tall by 40 wide:


I didn't try out the flip both in my code, it just popped in there when I was typing this. That is so that if it hits the corner of the brick it will change direction both ways.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 17th Jul 2009 23:29
can you kinda clarify the math?

i get everything up until the if, but it seems like a top collision would be represented by y<=5 and bally<brickcy and that a bottom would be y<=5 and bally>brickcy

BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 18th Jul 2009 02:10
The brick is 30 units tall and 40 units wide

So that means that the ideal difference between the brick center and the ball center is half of that (15 units up or down and 20 units right or left).

Basically it checks to see which offset is closest to the ideal case (15 and 20) by figuring out the difference between the distance itself and 15. Whichever is closer to 0 is treated as the collision case.

I just noted some ways to possibly improve it:
-Add an extra abs value around each equation, in case the difference is less than the ideal case (or to the if-then like so
If abs(y)<abs(x)...

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 18th Jul 2009 23:43
I guess members just kinda lost morale and quit the project

That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 19th Jul 2009 05:15
if we decide to go to 3d things just got easier, Josh Mooney has been doing a 100 models in a 100 days project over in the 3d board and he just made a pong paddle and pong ball as models

the best part is I never even asked him to, he just did it of his own free will!!

BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 19th Jul 2009 08:44
I don't think quitting is the right answer. Perhaps just polish version 1 and say its done.

Now you know my trouble

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 19th Jul 2009 21:00
i see your point, ok we'll stik with 2d

t10dimensional
15
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: Code Cave, USA
Posted: 19th Jul 2009 23:19 Edited at: 20th Jul 2009 00:12
I'm still here wanting to learn.

And for the collision thing could'nt you make the levles useing
data.You would just set it up like a grid like 10x and 8y.



Zero for no brick and 1-10 for the other bricks then read the data into arrays(10,8).Then for collision you just depending on where it is (the ball) do somthing to array(x,y) if it's >0.


That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 19th Jul 2009 23:40
good idea using data to hold the levels, that would make complex levels much easier

t10dimensional
15
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: Code Cave, USA
Posted: 20th Jul 2009 00:20 Edited at: 20th Jul 2009 00:22
Looking at page 4 I see that you have 4 bricks, so on the data thing you could have 4 diffrent balltypes.

0= no brick
1= 1 hit
2= 2 hit
3= 3 hit
4= can't be destroyed

So you can do what you guys did on the second project for the faces
just
if balltype<4 then balltype=balltype-1

This will change the image and the number of hits needed.


BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 20th Jul 2009 02:53
Data is a bad idea (sorry).

Better would be to use an external file that is read the same way as the data.

Why is this better:
-Easier to add levels/remove levels (just take them out of the file
-Easier to edit levels (can make an editor or whatever that outputs correctly)
-Neater code (don't need blocks of data statements
-Allows for future content release (not a big deal here, but should be considered on all projects). With data you would have to update an entire exe

All in all it is better, especially since reading from a file and reading from data are very much the same

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 20th Jul 2009 04:04
I was thinkin the same thing bn2

also we are guna use -1 for the indestructible bricks, cuz in ur methos we also would need a check to prevent the vtrength from going negative, meaning 2 checks, if we use -1 for indestructible then we just need one check

t10dimensional
15
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: Code Cave, USA
Posted: 20th Jul 2009 04:29 Edited at: 20th Jul 2009 04:40
@bn2
Same concept.But I see what you mean on the more efficient level.

@smartguy
Did'nt think of that.


That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 20th Jul 2009 05:20
YYYYAAAAAAAAAYYYYYYY, i fixed the collision!!!!!

I guess our main problem was using sprite collision() instead of sprite hit(), my theory is that when two sprites first hit, it doesnt trip the collision, only the hit

the second movement of the ball would trip the collision, and by then it was possible to have blown through half the ball and tripped multiple collision spots, causing the problem

so a simple switch to sprite hit() solved the problem

so yeah feel free to download the newest version on the first post

That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 20th Jul 2009 06:04
well the collision is better anyway, further research shows that there are still a few bugs

also do we want to leave it so that if you hit a corner you will essentially bounce back in both x and y axis or do we want to change it?

Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 21st Jul 2009 20:33
are you incrementing in your checks instead of adding the whole amount? i.e


Have you got the menu into a subroutine so the game can be paused?
I managed it but it was a lot of work because there were a lot of things relying on code that was redundant when switched to a subroutine.
I noticed a lot of that in this program; code is stuck to its current position because it relies on code from other places. With experience you will learn to make blocks of code as independant as possible so they can be called many times or moved, without breaking the program.

TGC Forum - converting error messages into sarcasm since 2002.
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 21st Jul 2009 21:14
hadnt thought of incrementing the balls movement one pixel at a time, checking fr collision each move, that would make things work much better, thanks obese!!

and yes the menu is a subroutine, but I havent tested jumping to it from the main game

That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 21st Jul 2009 22:42
ok i added obese's collision idea involving a step-by-step movement and the game LOOKS better, its tripping the collision the instant the ball hits the bricks rather than going into them slightly, but it doesnt work any better

the two key problems im encountering are:

1) every so often the top of ball collision is ignored and the ball flies through all the bricks, destroying each one it hits

2) for some reason sometimes if the bottom of ball or right of bal collisions occur, both trip, so if the ball hits the top of a brick then it always goes up and left, regardless of if it was going right when it hit the brick

any ideas?

the collision im using is the same as the one in the first post, the only change I have made is the addition of the step by step movement

Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 21st Jul 2009 23:07
I found that too I think it is a problem with the collision detection or the get_brick function. One or both are checking the area incorrectly eg if x<xmin and x>xmax instead of if x>xmin and x<xmax

TGC Forum - converting error messages into sarcasm since 2002.
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 21st Jul 2009 23:19 Edited at: 21st Jul 2009 23:21
PROBLEM SOLVED!!!!!!!

u were close obese, it was the get_brick function but not that problem

i never implemented a check to see if the brick number it returned still existed, so what was happenin went something like this:

in a situation such as
ddd
ddd
d-d

where d represents a brick, if the ball hit the center brick from the bottom (where the crater is) when we checked for a bottom collision it would register the destroyed brick as a bottom collision and keep moving up

a similar problem occured for the other problem

i have updated the first post with the working version and have added a Media Numbers .txt file for easy checking of what image number a brick is, what sprite numbe the ball is, etc

ok on the noobs wanted thread BB posted a score font, so now im off to get that implemented

Brick Break
User Banned
Posted: 21st Jul 2009 23:49 Edited at: 21st Jul 2009 23:57
Great, get that implemented. Hey, I made my own version of fullscreen mode, if anyone's interested. It retains the bitmap and everything when you switch between windows, it uses the full resolution of your monitor, and Alt-Tab works instantly! Feel free to use it. It's really cool.


WINNER list:
Latch, Lee Bamber, TDK, TheComet
Thanks for the help!
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 22nd Jul 2009 00:28
ok the scoring system is in place

go see the first post as usual

now might be a good time to start thinking about externally stored levels and a level editor

That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 22nd Jul 2009 06:58
i have worked out a system for externally saved levels, and will begin production of a leve editor tomorrow

i need to know though if we wish to encode the external level or not, meaning do we want to be able to open a level data file in notepad and view it, or not?

for those of you who havent ever used file access, I suggest you read TDK's 4th tutorial on file access

t10dimensional
15
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: Code Cave, USA
Posted: 22nd Jul 2009 09:04
The zip does'nt work for me.

When I run the code it says "image does not exist" which was the main menu image so I downloaded that and put it where it belongs.

But now it says "file does not exist" and it's just highlighting the "LOOP" part of the code.So is everything I need in the first post zip?


BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 22nd Jul 2009 13:07
Quote: "i need to know though if we wish to encode the external level or not, meaning do we want to be able to open a level data file in notepad and view it, or not?"


I would suggest yes, just for quick editing of levels (in case there is something wrong). Keeping it straightforward will keep it easier to manage.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 22nd Jul 2009 17:36
i agree bn2, but going that route, nobody is learning how to encode

i dont know why that would happen razer, ill check on it

That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 22nd Jul 2009 22:43 Edited at: 22nd Jul 2009 22:44
and i looked into ur problem razer, and it didnt occur

i downloaded the file, extracted it and ran the .dba file in it

maybe you only extracted part of the zip?

That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 22nd Jul 2009 23:29 Edited at: 22nd Jul 2009 23:30
sorry for trip post

ok new update

the main proram now works based off external files

i have removed that lengthy load_level subroutine and made a loadlevel function

IMPORTANT!!

if you wish to see this in action, follow these directions

download and extract the zip, same as always

DONT RUN THE MAIN FILE YET, instead run the external level test .dba file, this creates an example of an external level file

check to make sure that the levels.txt file was properly made, open it if you like

the format for each level in a file is as follows:

first the level header which is an l (L) followed by a number, this is the level number, so l1 is the header for level 1

next the number of bricks in that level (theoretically 182 bricks can fit into the screen minus the border)

then the actual brick data, each of which is made up of three pieces of data: brick type (1-3 for now), brick coordinate x (center i believe), brick coordinate y; in that order

then the level ends with a ;

so once you have ensured the file was created and is in the same folder as the DNG4.dba file then go ahead and run that

BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 23rd Jul 2009 00:33
Quote: "i agree bn2, but going that route, nobody is learning how to encode"


I don't see the need to encode it. Encoding it does several bad things and a couple good ones:

Good:
Keeps people from messing with your stuff

Bad:
Keeps people from adding onto your stuff (keeps the game alive after you don't continue support)

Bad:
Makes it a requirement to have and make a map maker. If it is encoded, only you can do it.

If you want an easy way to kinda do both:

Use a fileblock to encode each one. That way, it is really easy to get at (just read it out) and you can keep it encrypted. You could write a program that would take the file and enter it into a new fileblock so that if people make something, they can convert it and that way they can't get at your stuff.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 23rd Jul 2009 00:49
i meant encoding as in using the built in read byte, read word, etc commands, not anything fancy thats hard to figure out

also do u think in the level editor we should make it a free place system, where you could place bricks anywhere, or limit it so that you can only place them in certain spots, or maybe try and do both?

BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 23rd Jul 2009 00:50
I would suggest a grid type deal, turning a grid coordinate on or off for a brick.

If you have time and motivation a free place system could be good, but I imagine it would be tedious to try to get a straight line of bricks

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 23rd Jul 2009 00:55
right that was the point of the question

ive not got much if anything going on right now so im doing a lot of coding

ill start with the grid placing system then maybe add a free place system option for when you want to do a special design of bricks or watevr

is it just me or did this project start with like 5 members and 3 advisors, then go down to u and me?

BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 23rd Jul 2009 01:53 Edited at: 23rd Jul 2009 02:11
seems like. I am not even officially part of this one, just in my free time when not working on my game for that one competition I pop in.

Don't forget about razer though, he is still floating around waiting for something to do.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Irojo
15
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 23rd Jul 2009 02:33
Finally figured out how to fix the music length...

The Menu.

If this still isn't fixed, I picked the wrong file. Lemme know if that's the case.


Time is money. I just ripped you off.

Attachments

Login to view attachments
Irojo
15
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 23rd Jul 2009 02:35
...and the maingame.


Time is money. I just ripped you off.

Attachments

Login to view attachments
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 23rd Jul 2009 05:55 Edited at: 23rd Jul 2009 05:55
um irojo, i just noticed that ur exporting the wrong music file type, AIFF's arent supported by DBC

look here at what type of music files are:

http://darkbasic.thegamecreators.com/?f=features#formats

Brick Break
User Banned
Posted: 23rd Jul 2009 06:28
o_O That's a lot. I always just stick to mp3 because of its popularity.

WINNER list:
Latch, Lee Bamber, TDK, TheComet
Thanks for the help!
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 23rd Jul 2009 06:37
i agree BB

Brick Break
User Banned
Posted: 23rd Jul 2009 07:11
So, TheComet, did you fix it?

WINNER list:
Latch, Lee Bamber, TDK, TheComet
Thanks for the help!
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 23rd Jul 2009 07:37
ur either in the wrong thread or said the wrong name BB

ok go view the first post

a simple level editor is now included, nothing fancy

click on the grid to place bricks

mouse wheel to change bricks (only 1-3 hit blocks are currently utilized)

enter/return to save the level, if the levels.txt already exists when you try to save then it will tell you so and return to the editor, no work on the current level is lost

HOWEVER!!! once you hit enter the level is saved and the program ends, you cannot load a file (yet) so be aware of this once you hit enter

i plan to continue work tomorrow, but tonight im beat and going to bed

tomorrows plans:

load file button, nicer looking GUI, multiple level functionality (this is already implemented into the main game, but not into the editor)

that last task reminds me, should you make a level and complete it in the main game, you will enter an endless loop and must f12 out

Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 23rd Jul 2009 16:36
Quote: "mouse wheel "
Darn this laptop!

Sigh, srry i've been gone, but i got a little tied up in going out of town(i planed to keep helping but..............forgot my laptop). Will read above and fill myself in.

Your signature has been erased by a mod because it was too big.CHANGE IT OR DIE!!!!!
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 23rd Jul 2009 17:23
YAAAAAAAYYYYY the team is slowly regenerating!!!

a lot has happened since u left, heres a summary of the main chages:

changed collision over to sprite hit() rather thsn collision, also made it loop through each pixel of motion rather than just check the end result of the move

added score system with custom score font

changed the level making over to external files (deleting you're levels, sorry)

made a level editor (not finished but working)

right now just try and familiarize urself with the mew programs, then let me know when you are ready for a job

Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 23rd Jul 2009 17:32
All changes are in the first post, i think?

Yeah i'll be ready to tackle somthing soon.

Oh and I've givin up on that TDS. It.....................Crashed.

Your signature has been erased by a mod because it was too big.CHANGE IT OR DIE!!!!!
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 23rd Jul 2009 17:49
the changes arent logged anywhere, the first post just shows the current version

Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 23rd Jul 2009 17:55
oh. kk. will test.

Your signature has been erased by a mod because it was too big.CHANGE IT OR DIE!!!!!
Irojo
15
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 23rd Jul 2009 19:52 Edited at: 23rd Jul 2009 20:42
This is odd to me smartguy, because I have uploaded the aif's from my mac computer, and have had no issue running them on dbc on my windows. The music loops and everything.




Time is money. I just ripped you off.
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 23rd Jul 2009 20:39
i havent actually tried running them, i just saw it was an unusual file, looked online to see if it would run, and saw that it wouldnt so i never tried

ill try em later

Login to post a reply

Server time is: 2024-05-20 09:17:43
Your offset time is: 2024-05-20 09:17:43