So.. i started looking at the tutorial and then at the samples and made this for an experiment:
I have programmed pretty much in gamemaker before..
GOSUB Init
main:
GOSUB MoveAll
GOSUB ShowAll
GOTO main
SUB Init:
DIMDATA player_x[], 450
DIMDATA player_y[], 450
DIMDATA lifts[], 0
DIMDATA gforce[], 0
LOADSPRITE "ball.bmp" ,0
ENDSUB
SUB MoveAll:
FOR num=0 TO 1
IF KEY(57) AND lifts=0 THEN lifts=20
IF lifts>0 THEN player_y=player_y-1.7*SQR(lifts)
IF player_y<450 THEN player_y=player_y+1
NEXT
ENDSUB
SUB ShowAll:
FOR num=0 TO 1
DRAWSPRITE 0, player_x, player_y
SHOWSCREEN
NEXT
ENDSUB
When executing the code i got this:
compiling:
C:\DOCUME~1\ADMINI~1\LOKALA~1\Temp\glbasic\gpc_temp0.cpp: In function `DGInt __GLBASIC__::MoveAll()':
C:\DOCUME~1\ADMINI~1\LOKALA~1\Temp\glbasic\gpc_temp0.cpp:52: error: ambiguous overload for 'operator==' in '__GLBASIC__::lifts == 0'
C:\DOCUME~1\ADMINI~1\LOKALA~1\Temp\glbasic\gpc_temp0.cpp:52: note: candidates are: operator==(DGNat, int) <built-in>
C:\DOCUME~1\ADMINI~1\LOKALA~1\Temp\glbasic\gpc_temp0.cpp:52: note: operator==(DGInt, int) <built-in>
C:/Program/GLBasic/Compiler/platform/Include/glb.h:245: note: bool __GLBASIC__::operator==(int, __GLBASIC__::CGStr)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:245: note: bool __GLBASIC__::operator==(int, const __GLBASIC__::DGStr&)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:245: note: bool __GLBASIC__::operator==(float, __GLBASIC__::CGStr)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:245: note: bool __GLBASIC__::operator==(float, const __GLBASIC__::DGStr&)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:245: note: bool __GLBASIC__::operator==(double, __GLBASIC__::CGStr)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:245: note: bool __GLBASIC__::operator==(double, const __GLBASIC__::DGStr&)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:245: note: bool __GLBASIC__::operator==(const __GLBASIC__::DGStr&, __GLBASIC__::CGStr)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:245: note: bool __GLBASIC__::operator==(const __GLBASIC__::DGStr&, const __GLBASIC__::DGStr&)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:245: note: bool __GLBASIC__::operator==(const __GLBASIC__::DGStr&, int)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:245: note: bool __GLBASIC__::operator==(const __GLBASIC__::DGStr&, float)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:245: note: bool __GLBASIC__::operator==(const __GLBASIC__::DGStr&, double)
C:\DOCUME~1\ADMINI~1\LOKALA~1\Temp\glbasic\gpc_temp0.cpp:53: error: no match for 'operator=' in '__GLBASIC__::lifts = 20'
C:/Program/GLBasic/Compiler/platform/Include/glb.h:283: note: candidates are: __GLBASIC__::DGIntArray& __GLBASIC__::DGIntArray::operator=(const __GLBASIC__::DGIntArray&)
C:\DOCUME~1\ADMINI~1\LOKALA~1\Temp\glbasic\gpc_temp0.cpp:54: error: ambiguous overload for 'operator>' in '__GLBASIC__::lifts > 0'
C:\DOCUME~1\ADMINI~1\LOKALA~1\Temp\glbasic\gpc_temp0.cpp:54: note: candidates are: operator>(DGNat, int) <built-in>
C:\DOCUME~1\ADMINI~1\LOKALA~1\Temp\glbasic\gpc_temp0.cpp:54: note: operator>(DGInt, int) <built-in>
C:/Program/GLBasic/Compiler/platform/Include/glb.h:250: note: bool __GLBASIC__::operator>(int, __GLBASIC__::CGStr)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:250: note: bool __GLBASIC__::operator>(int, const __GLBASIC__::DGStr&)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:250: note: bool __GLBASIC__::operator>(float, __GLBASIC__::CGStr)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:250: note: bool __GLBASIC__::operator>(float, const __GLBASIC__::DGStr&)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:250: note: bool __GLBASIC__::operator>(double, __GLBASIC__::CGStr)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:250: note: bool __GLBASIC__::operator>(double, const __GLBASIC__::DGStr&)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:250: note: bool __GLBASIC__::operator>(const __GLBASIC__::DGStr&, __GLBASIC__::CGStr)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:250: note: bool __GLBASIC__::operator>(const __GLBASIC__::DGStr&, const __GLBASIC__::DGStr&)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:250: note: bool __GLBASIC__::operator>(const __GLBASIC__::DGStr&, int)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:250: note: bool __GLBASIC__::operator>(const __GLBASIC__::DGStr&, float)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:250: note: bool __GLBASIC__::operator>(const __GLBASIC__::DGStr&, double)
C:\DOCUME~1\ADMINI~1\LOKALA~1\Temp\glbasic\gpc_temp0.cpp:55: error: ambiguous overload for 'operator-' in '__GLBASIC__::player_y - (__GLBASIC__::SQR((&__GLBASIC__::lifts)->__GLBASIC__::DGIntArray::operator DGInt()) * 1.69999999999999995559107901499373838305473327637e+0)'
C:\DOCUME~1\ADMINI~1\LOKALA~1\Temp\glbasic\gpc_temp0.cpp:55: note: candidates are: operator-(DGNat, double) <built-in>
C:\DOCUME~1\ADMINI~1\LOKALA~1\Temp\glbasic\gpc_temp0.cpp:55: note: operator-(DGInt, double) <built-in>
C:/Program/GLBasic/Compiler/platform/Include/glb.h:221: note: __GLBASIC__::DGStr __GLBASIC__::operator-(int, const __GLBASIC__::DGStr&)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:221: note: __GLBASIC__::DGStr __GLBASIC__::operator-(float, const __GLBASIC__::DGStr&)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:221: note: __GLBASIC__::DGStr __GLBASIC__::operator-(double, const __GLBASIC__::DGStr&)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:221: note: __GLBASIC__::DGStr __GLBASIC__::operator-(const __GLBASIC__::DGStr&, const __GLBASIC__::DGStr&)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:221: note: __GLBASIC__::DGStr __GLBASIC__::operator-(const __GLBASIC__::DGStr&, int)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:221: note: __GLBASIC__::DGStr __GLBASIC__::operator-(const __GLBASIC__::DGStr&, float)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:221: note: __GLBASIC__::DGStr __GLBASIC__::operator-(const __GLBASIC__::DGStr&, double)
C:\DOCUME~1\ADMINI~1\LOKALA~1\Temp\glbasic\gpc_temp0.cpp:56: error: ambiguous overload for 'operator<' in '__GLBASIC__::player_y < 450'
C:\DOCUME~1\ADMINI~1\LOKALA~1\Temp\glbasic\gpc_temp0.cpp:56: note: candidates are: operator<(DGNat, int) <built-in>
C:\DOCUME~1\ADMINI~1\LOKALA~1\Temp\glbasic\gpc_temp0.cpp:56: note: operator<(DGInt, int) <built-in>
C:/Program/GLBasic/Compiler/platform/Include/glb.h:249: note: bool __GLBASIC__::operator<(int, __GLBASIC__::CGStr) <near match>
C:/Program/GLBasic/Compiler/platform/Include/glb.h:249: note: bool __GLBASIC__::operator<(int, const __GLBASIC__::DGStr&)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:249: note: bool __GLBASIC__::operator<(float, __GLBASIC__::CGStr) <near match>
C:/Program/GLBasic/Compiler/platform/Include/glb.h:249: note: bool __GLBASIC__::operator<(float, const __GLBASIC__::DGStr&)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:249: note: bool __GLBASIC__::operator<(double, __GLBASIC__::CGStr) <near match>
C:/Program/GLBasic/Compiler/platform/Include/glb.h:249: note: bool __GLBASIC__::operator<(double, const __GLBASIC__::DGStr&)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:249: note: bool __GLBASIC__::operator<(const __GLBASIC__::DGStr&, __GLBASIC__::CGStr) <near match>
C:/Program/GLBasic/Compiler/platform/Include/glb.h:249: note: bool __GLBASIC__::operator<(const __GLBASIC__::DGStr&, const __GLBASIC__::DGStr&)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:249: note: bool __GLBASIC__::operator<(const __GLBASIC__::DGStr&, int)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:249: note: bool __GLBASIC__::operator<(const __GLBASIC__::DGStr&, float)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:249: note: bool __GLBASIC__::operator<(const __GLBASIC__::DGStr&, double)
C:\DOCUME~1\ADMINI~1\LOKALA~1\Temp\glbasic\gpc_temp0.cpp:57: error: ambiguous overload for 'operator+' in '__GLBASIC__::player_y + 1'
C:\DOCUME~1\ADMINI~1\LOKALA~1\Temp\glbasic\gpc_temp0.cpp:57: note: candidates are: operator+(DGNat, int) <built-in>
C:\DOCUME~1\ADMINI~1\LOKALA~1\Temp\glbasic\gpc_temp0.cpp:57: note: operator+(DGInt, int) <built-in>
C:/Program/GLBasic/Compiler/platform/Include/glb.h:220: note: __GLBASIC__::DGStr __GLBASIC__::operator+(int, __GLBASIC__::CGStr) <near match>
C:/Program/GLBasic/Compiler/platform/Include/glb.h:220: note: __GLBASIC__::DGStr __GLBASIC__::operator+(int, const __GLBASIC__::DGStr&)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:220: note: __GLBASIC__::DGStr __GLBASIC__::operator+(float, __GLBASIC__::CGStr) <near match>
C:/Program/GLBasic/Compiler/platform/Include/glb.h:220: note: __GLBASIC__::DGStr __GLBASIC__::operator+(float, const __GLBASIC__::DGStr&)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:220: note: __GLBASIC__::DGStr __GLBASIC__::operator+(double, __GLBASIC__::CGStr) <near match>
C:/Program/GLBasic/Compiler/platform/Include/glb.h:220: note: __GLBASIC__::DGStr __GLBASIC__::operator+(double, const __GLBASIC__::DGStr&)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:220: note: __GLBASIC__::DGStr __GLBASIC__::operator+(const __GLBASIC__::DGStr&, __GLBASIC__::CGStr) <near match>
C:/Program/GLBasic/Compiler/platform/Include/glb.h:220: note: __GLBASIC__::DGStr __GLBASIC__::operator+(const __GLBASIC__::DGStr&, const __GLBASIC__::DGStr&)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:220: note: __GLBASIC__::DGStr __GLBASIC__::operator+(const __GLBASIC__::DGStr&, int)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:220: note: __GLBASIC__::DGStr __GLBASIC__::operator+(const __GLBASIC__::DGStr&, float)
C:/Program/GLBasic/Compiler/platform/Include/glb.h:220: note: __GLBASIC__::DGStr __GLBASIC__::operator+(const __GLBASIC__::DGStr&, double)
*** FATAL ERROR - Please post this output in the forum
and so i did.
thanks in advance.
Hello!
DIMDATA is for putting values into an array, use GLOBAL instead, at the start of the program:
GLOBAL player_x = 450
GLOBAL player_y = 450
GLOBAL lifts = 0
GLOBAL gforce = 0
This will declare the variables as local and initialize them to the values.
To make an array you put squarebrackets behind, like this:
GLOBAL object[5]
This gives you an array with five slots in it, numbered 0 to 4. You access them by typing:
object[0] = 450
object[1] = 40
...
Or you can initialize all the slots in one line like you started in your program:
DIMDATA object[], 450, 40, 0, 0, 0
Thanks for such quick answer.
Im glad i understand exactly what you said since this is a new program for me. =D