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 / Why wont my Circle Show Up?

Author
Message
Lonnie
21
Years of Service
User Offline
Joined: 28th May 2003
Location:
Posted: 16th Oct 2003 02:00
Here is the code Im having trouble with, I just did some of the DBHeaven Tutorials. Now Im trying some thing a little differnt:
Do
Gosub Defaults
Gosub InputStuff
Loop

Defaults:
Blue = RGB(0,0,255)
Red = RGB(255,0,0)
Green = RGB(0,255,64)
Yellow = RGB(255,255,0)
White = RGB(255,255,255)
Randomize Timer()
Hide Mouse
Sync On
Sync Rate 60
Radius = 10
acc# = 0.2
gravity# = 0.0
TRUE = 1
FALSE= 0
yspeed# = 0.0
xspeed# = 0.0

Return

InputStuff:
If Upkey = TRUE then yspeed#= (yspeed# + acc#)
If Downkey = TRUE then yspeed#= (yspeed# - acc#)
If Leftkey = TRUE then xspeed#= (xspeed# - acc#)
If Upkey = TRUE then xspeed#= (xspeed# + acc#)
Return

The Trouble is that I dont know how to get the circle to appear, then Ill just mess around till I get it to work! You may beable to figure out this code. (what it does, mabey)

Thanks!

Do Print "Hello World"
Wait 2003 loop
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 16th Oct 2003 02:06
1.
What circle???

2.
the gosub defaults should be outside loop.

3. put in a circle command!

If your mansion house needs haunting, just call Rentaghost!
Lonnie
21
Years of Service
User Offline
Joined: 28th May 2003
Location:
Posted: 16th Oct 2003 02:16
Sorry, Here is the code again:

Gosub Defaults
Gosub InputStuff

Defaults:
Blue = RGB(0,0,255)
Red = RGB(255,0,0)
Green = RGB(0,255,64)
Yellow = RGB(255,255,0)
White = RGB(255,255,255)
Randomize Timer()
Hide Mouse
Sync On
Sync Rate 60
Radius = 10
acc# = 0.2
gravity# = 0.0
TRUE = 1
FALSE= 0
yspeed# = 0.0
xspeed# = 0.0
CIRCLE xspeed#,yspeed#,Radius

Return

InputStuff:
If Upkey = TRUE then yspeed#= (yspeed# + acc#)
If Downkey = TRUE then yspeed#= (yspeed# - acc#)
If Leftkey = TRUE then xspeed#= (xspeed# - acc#)
If Upkey = TRUE then xspeed#= (xspeed# + acc#)
Return

Do Print "Hello World"
Wait 2003 loop
Lonnie
21
Years of Service
User Offline
Joined: 28th May 2003
Location:
Posted: 16th Oct 2003 02:32
Im only trying to move a circle on the screen for now. Thanks!

(Oh sorry about double posting)

Do Print "Hello World"
Wait 2003 loop
KNau
21
Years of Service
User Offline
Joined: 25th Nov 2002
Location: Canada
Posted: 16th Oct 2003 04:17
Hope this helps:



I trimmed it a bit to show only the essential parts. You have a very strange coding style , I don't think I've ever seen anyone use IF UPKEY() = TRUE instead of IF UPKEY() = 1.

Incidentally you need to use the brackets for key inputs "UPKEY()". And you couldn't move the circle because you kept resetting the xspeed# and yspeed# positions to zero. You also needed to put it all into a DO/LOOP to make it work properly.

Lastly I don't know what you were planning to do with Blue = RGB(0,0,255) but that won't work with the INK command. INK requires the RGB or colour value to work, so you wouldn't be able to use "INK Blue" like that.

http://www.canceriannewmedia.com
Lonnie
21
Years of Service
User Offline
Joined: 28th May 2003
Location:
Posted: 16th Oct 2003 06:17
K,
That was was not my own style, I was kinda copping stuff from www.dbheaven.com.

Oh and thanks for the code and ya, I most deffinatly for got the "(" and ")" brackets!

Thanks alot!

Later

Do Print "Hello World"
Wait 2003 loop
Lonnie
21
Years of Service
User Offline
Joined: 28th May 2003
Location:
Posted: 16th Oct 2003 22:32
Sorry, but yet again some more help will be required.
Here is the code:


And Umm...
My Problem is, (for now) why dues the ball flash so strangly? (or is it just me, or my comp) But Im pretty sure it has something to do with the Sync, I just dont know what, I try fiddling with it, but that just makes the circle dissapear.
Thanks!

Do Print "Hello World"
Wait 2003 loop
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 16th Oct 2003 22:54


If your mansion house needs haunting, just call Rentaghost!
Lonnie
21
Years of Service
User Offline
Joined: 28th May 2003
Location:
Posted: 16th Oct 2003 23:08 Edited at: 16th Oct 2003 23:23
Wow, cool thanks Spooky!

Thanks alot!

Edit: Well I tried the code, but now it only move near the walls. Ill expirement.

Edit 2: Alright, I see the problem, I think its the sync again, but how to fix it with out having a flashing circle, Ill have to keep experimenting. (and mabey even Download the newer version of DarkBASIC instead of version 4.1 or what ever)

Edit 3: I just changed the sync rate to 20 or whatever, and it seems to work! Thanks spooky!

Do Print "Hello World"
Wait 2003 loop
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 17th Oct 2003 01:05
The only reason you were having flashing circle was because of the line (and following ypos line):

xpos# = -xpos# + xspeed#

so, if xpos was 200, next loop it would be -200 (ie off the screen), then back to 200. So it was only drawing circle every other frame.

So should have been

xpos# = xpos# + xspeed#

If your mansion house needs haunting, just call Rentaghost!
Lonnie
21
Years of Service
User Offline
Joined: 28th May 2003
Location:
Posted: 17th Oct 2003 08:23
Thanks!

Do Print "Hello World"
Wait 2003 loop

Login to post a reply

Server time is: 2024-09-21 06:39:05
Your offset time is: 2024-09-21 06:39:05