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 / Declaration Not Valid.....

Author
Message
t701ultimatum
12
Years of Service
User Offline
Joined: 28th Nov 2011
Location:
Posted: 1st Dec 2011 06:06
Hey guys,
Im trying to do the tutorial for Pong by dcfoermanuk.

Im following it to the letter and at part 3, Ive just finished with the loading the files, he says to compile, just to check there are no errors in finding the file, but when I compile, i get "Declaration not valid at line 3"

Im still verrry new to coding, so I have no idea whats wrong, any chance one of you wonderful people could help?

Here is the code:

Randomize Timer()

Type ObjectData
x as a float
y as a float
xspeed as a float
yspeed as a float
Lives as a Integer
Trigger as a Integer
EndType

global Player as ObjectData
global AI as ObjectData
global Ball as ObjectData

Ball.x = 320
Ball.y = 240
Ball.xspeed = -2
Ball.yspeed = rnd(1)+1

Player.x = 590
Player.y = 240
Player.Lives = 3

AI.x = 50
AI.y = 240
AI.Live = 3
AI.Trigger = 200

REM Game Initialzation

Sync On
Sync rate 60
backdrop on
color backdrop RGB(0, 196, 0)

path$ = get dir$()
load sound path$ + "\" + "Impact.wav", 1
load sound path$ + "\" + "Boundry.wav", 2
load sound path$ + "\" + "Win.wav", 3
load sound path$ + "\" + "Loose.wav", 4

Georga, the M16A4. The Only Woman I'll ever need.
nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 1st Dec 2011 08:25 Edited at: 1st Dec 2011 08:27
You are incorrectly declaring your UDT data inside your Type. Try changing "a float" to just "float". See below code.



Also, please place your code in snippets. You can do this by placing [ code ] without the spaces at the beginning of your code and [ /code ] without the spaces the end of your code.

t701ultimatum
12
Years of Service
User Offline
Joined: 28th Nov 2011
Location:
Posted: 1st Dec 2011 08:37
Thank you so much, you are a life saver!

And I am really sorry about the code, it was my first time
so i just clicked code, forgot to end with

Georga, the M16A4. The Only Woman I'll ever need.
nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 2nd Dec 2011 16:00
No problem, anytime

Login to post a reply

Server time is: 2024-11-22 11:38:09
Your offset time is: 2024-11-22 11:38:09