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 / Im a 2D noob, and need to make this go right, see inside plz

Author
Message
Blinn
20
Years of Service
User Offline
Joined: 25th Jan 2004
Location: Behind a keyboard... pffft Duhh!
Posted: 4th Feb 2004 20:36
i did the cmd

do
line 100,500,100,100
loop

that line servs as the floor and the player is a dot (il make him into a sprite soon enough)

as the collision code for it it looks like this

liney=100
doty=101
dotx=101
do
line 100,500,100,100
if doty < liney then doty=doty+1
loop

now this works all fine and dandy, except the line (floor) flashes, cus it redraws it in the loop every time, so i have a flashing floor which i dont want...

and also the collision barrier thing is along the whole of the y axis at 100... i only want it over the line

elp me please

Good night, good morning, good day? whats so good about it?!?!?
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 4th Feb 2004 20:38 Edited at: 4th Feb 2004 20:44
the line floor is flashing because it's in the loop, put it before your loop starts.

edit

This is what I have for you so far:

line 50,300,550,300

do

sync
loop

-RUST-
"What the... Mooooooooooo!"
Blinn
20
Years of Service
User Offline
Joined: 25th Jan 2004
Location: Behind a keyboard... pffft Duhh!
Posted: 4th Feb 2004 21:42
thats what i got so far (see source)
but if i put the line cmd before the loop, it disapears after the first CLS fromt he main loop

Good night, good morning, good day? whats so good about it?!?!?
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 4th Feb 2004 22:22
If you are using SYNC make sure you have a SYNC ON at the top of your code otherwise you can get flickering.

Having said that your code works with out flickering in dbpro if I move the line command into the loop.

Our civilization faces three great dangers. The first is destruction by a nuclear war, the second is being crippled with overpopulation and the third is the Age of Leisure.
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 4th Feb 2004 23:15
I have done little to no 2d stuff but if it's anything like 3d then

the line command should be outside the loop
Your loop should do whatever processing and continually sync the screen.
I see no need for cls as part of a main loop.
if a screen is cls'ed then re-synced will the line reappear?

-RUST-
"What the... Mooooooooooo!"
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 4th Feb 2004 23:57
The 2d commands draw directly to the screen bitmap unlike the 3d commands.
Quote: "if a screen is cls'ed then re-synced will the line reappear?"


No because the line command draws a line on the screen bitmap, the cls then clears the screen bitmap and the sinc draws the black screen bitmap to the screen.

Our civilization faces three great dangers. The first is destruction by a nuclear war, the second is being crippled with overpopulation and the third is the Age of Leisure.
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 5th Feb 2004 01:05
ah ha. ok, thanks.

-RUST-
"What the... Mooooooooooo!"

Login to post a reply

Server time is: 2024-09-21 21:16:18
Your offset time is: 2024-09-21 21:16:18