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 / A few questions...

Author
Message
Timmeh
18
Years of Service
User Offline
Joined: 15th Nov 2005
Location: Somewhere... I think...
Posted: 3rd Sep 2006 20:22
I'm relitivly new to dark basic and have a few questions...
1. When I use this code:

I put the load and get image lines at the begining of my program and the paste image after I use cls (in the main loop) but it still doesn't draw the player. What's wrong? I get no errors when compiling and the file IS there.

2. What size is the default screen. I need to draw GAME OVER in the middle when the player dies (which I did) but I can't figure out how wide and tall the screen is to do so.

3. In my game the player has to dodge lasers that fly at him from the right side of the screen (I know, really basic...) but I wanted to know if there was a quicker way than what I'm doing which is creating a variable for every lazers x and y position and then making them move from the right to the left and checking each ones collisions with the player seperatly. Is there an easier way to do this?

4. Are the sprite collisions exact or ar they box collisions? I ask because I figure I could just load one huge map file and run a collision with it instead of each seperate object.

5. What is the easiest way to make a map. I have a feeling creating every object and positioning it seperatly directly through code may not be the fastest way

Thank you for your time,
Timmeh

Timothy Sassone
Hippie Dude
19
Years of Service
User Offline
Joined: 6th Feb 2005
Location: California, United States
Posted: 3rd Sep 2006 21:53
Wow, alot of questions!

1. You need to paste the image on the screen before you grab it, so change your code to this.


2. Put this code at the end of your loop. It will tell your your screens size. Take it out of your code once you,ve recorded it.


3. I'm not exactly sure, I'd need to see your code.

4. I think it's a box, don't quote me on that.

5. Open up paint, draw the map with the correct screen dimensions, then upload to your program and just write the collision statements.

I hope I was a help.

Mysteries Surround You
Timmeh
18
Years of Service
User Offline
Joined: 15th Nov 2005
Location: Somewhere... I think...
Posted: 3rd Sep 2006 22:23
Thank you very much! However, how would I write collision statements for a bitmap file?
As for number three... Here is my code.
In the start of the program:

In the main loop for movement:

For the collisions (also in the main loop):


And as for four I ment if I drew a maze and put a box inside it would the box trigger a collision if it wasn't actualy touching the walls?

Thanks again for your help!

Timmeh

Timothy Sassone
Cave Man
18
Years of Service
User Offline
Joined: 22nd Aug 2006
Location: North Carolina, US
Posted: 3rd Sep 2006 22:59 Edited at: 3rd Sep 2006 23:09
Hi
1:
There is no need to use "get image" when you load an image, just leave it out. when you use "get image" it cuts a piece from the current bitmap(in most cases, the screen) and stores it as an image. so all you are doing is erasing the image that you just loaded.
2: "screen width" and "screen height" commands, just use somthing like this



4: Sprites don't have pixel perfect collision. im not sure what you mean after that part.


Language: DBP 6.2
Cream cheese is your enemy. Sweet tea is your freind.
Hippie Dude
19
Years of Service
User Offline
Joined: 6th Feb 2005
Location: California, United States
Posted: 3rd Sep 2006 23:12
I didn't mean to write a collision for a bitmap. I meant that if you have terrain. Then you could just write a collision statement for that spot instead of drawing the terrain parts seperately.

Mysteries Surround You
Code Dragon
18
Years of Service
User Offline
Joined: 21st Aug 2006
Location: Everywhere
Posted: 4th Sep 2006 01:05 Edited at: 4th Sep 2006 01:11
Hello.

2. If you don't already know this then you don't have to recalculate the screen size every loop, you can precalculate the text coordinates in variables. You can also use center text, so you don't have to subtract the text width from the coordinate, it will automatically center it. Instead you could use set display mode to make sure the resolution is the same every time.



3. You don't have to create a separate variable for each coordinate. You should put the coordinates in a type and array. You could then use a for next loop so the code will check for collision for all the bullets like this:



This way your collision code will check every bullet, no matter how many there are. There's also some tutorials in the newsletter I saw that might help.

Newsletter 28 - Asset Managment

Newsletter 29 - Scalable Assets and Asset Templates
Timmeh
18
Years of Service
User Offline
Joined: 15th Nov 2005
Location: Somewhere... I think...
Posted: 5th Sep 2006 16:22
I don't think that works in DB classic... Don't have pro yet...

Timothy Sassone
D Ogre
20
Years of Service
User Offline
Joined: 19th Nov 2003
Location:
Posted: 7th Sep 2006 02:16 Edited at: 7th Sep 2006 02:21
Actually, sprites do have pixel perfect sprite collision for DBC. You must
enable the transparency with SET SPRITE sprite number, 0 ,1 first.

This doesn't hold true for DBPro though. There is no PPC for sprites with this
version. Sprites in DBPRO are treated differently; they are technically 3D which
aids in faster rendering due to utilization of 3D hardware exceleration. There are
work arounds for the lack of PPC in DBPro though.

The default screen resolution is set to 640 x 480. You can change this by
using SET DISPLAY MODE Xsize, Ysize, Color Depth. You can still use
the methods mentioned above for positioning text, bitmaps, sprites and objects.

Before posting a question, please state which version of DB you're using in your
original post. This way people here in the forums can answer your questions
appropriately.

You can still use the code snippet that Code Dragon provided. Instead of using
variable TYPES with an array, you will just have to use a stardard array table.

Login to post a reply

Server time is: 2024-09-25 07:36:40
Your offset time is: 2024-09-25 07:36:40