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 / Where should I go from here?

Author
Message
Romedi
19
Years of Service
User Offline
Joined: 14th Jun 2005
Location: East Alabama
Posted: 15th Jun 2005 04:59
Hi everyone. I have had DarkBASIC Classic for 4 days now, I have followed Binary Moon's tutorial through the Basic and 2D sections. I can make shapes and move them with my arrow keys(except for a square couldnt fit that into the code given in the tutorial that comes with the language). Now I have a few questions:

1. I used the following code to make green grass on the bottom half of the screen and a ramdom starry sky over the horizon.



The problem I am having with this is that I cannot make random red dots appear on the bottom half of the screen to simulate rocks in the grass.

Also, why does the x2,y2 portion of the box formula have to be one less than the maximum screen resolution for the box to appear? (639,479 instead of 640,480)
NanoBrain
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 15th Jun 2005 07:24
Romedi,

This is a double post. Do not double post in the forums.


+NanoBrain+
D Ogre
20
Years of Service
User Offline
Joined: 19th Nov 2003
Location:
Posted: 15th Jun 2005 12:22
You can still use RND(number) to place the red dots at the bottom of the screen only. Let's say your grass is the full X width of the screen and your grass fills 240 pixels tall from the bottom of the screen. You can do the the following.

Generic code:



Of course, you will have to place this in some kind of loop to make it work. The RND() function will always return a random value between zero and the number placed within the parenthesis. To keep the values within a determined range other than zero and the max number, you have to add an offset value to the random number. In this case, it is 240.

If a value of 0 is returned:
y = 0 + 240 = 240

if a value of 239 is returned:
y = 239 + 240 = 479

Your screen always starts with 0,0 being the origin. That is why your max bottom right pixel is 639 by 479 (640 x 480).
Romedi
19
Years of Service
User Offline
Joined: 14th Jun 2005
Location: East Alabama
Posted: 15th Jun 2005 14:48
Sry for the double post, when i sent my first one I did not see the red message that said that the post had to be reviewed first. Therefore I thought that maybe it messed up when I cliked to post the message.

Once again, sry for that
NanoBrain
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 15th Jun 2005 23:47
Romedi,

I understand. Just helping the moderation, I suppose.


+NanoBrain+
DarkMoon productions inc
19
Years of Service
User Offline
Joined: 13th Jun 2005
Location: The DarkMoon productions office
Posted: 16th Jun 2005 05:10
hey look a penguin!

yeah stop spamming!

- Check out my game designing blog! http://markdarksgamedesigningblog.blogspot.com/

I am No one. And no one is perfect. SO I AM PERFECT!

Login to post a reply

Server time is: 2024-09-23 21:16:14
Your offset time is: 2024-09-23 21:16:14