just a bunch of demos strung together!
// --------------------------------- //
// Project: sprite_test_1
// Start: Monday, January 17, 2011
// IDE Version: 8.203
// FREE-VERSION:
// Need Premium for Features:
// 3D Graphics
// Network Commands
// INLINE C/C+++ code
// SETCURRENTDIR("Media") // seperate media and binaries?
globalSettings:
GLOBAL screenHeight = 320
GLOBAL screenWidth = 240
GLOBAL colorDepth = 16
SETTRANSPARENCY RGB (0,128,0)
globalVariables:
SETSCREEN screenHeight, screenWidth, colorDepth
GLOBAL currentFrame% = 2001
GLOBAL currentFrameAngle% = 0
GLOBAL currentFrameY% = 125
GLOBAL currentFrameYSize% = 0
GLOBAL currentFrameX% = 100
GLOBAL currentFrameXtest% = currentFrameX%
GLOBAL currentFrameXSize% = 0
GLOBAL active% = 1
GLOBAL jumpValX% = 5
GLOBAL jumpValY% = 5
GLOBAL scrollValX% = 5
GLOBAL scrollValY% = 5
GLOBAL mykeys$ = INKEY$()
GLOBAL gForce% = 10
GLOBAL gForceAccel% = 0
GLOBAL hangTimer% = GETTIMER()
GLOBAL hangTime% = 1
GLOBAL gravity% = 1
GLOBAL isFalling% = 1
GLOBAL dtime%
GLOBAL fps%
GLOBAL delay%
GLOBAL showfps%
GLOBAL downButton% = 0
GLOBAL upButton% = 0
GLOBAL upButtonPressed%
GLOBAL leftButton% = 0
GLOBAL rightButton% = 0
GLOBAL buttonpress% = 0
GLOBAL platform% = 1001
GLOBAL platformx% = 0
GLOBAL platformbx% = 0
GLOBAL platformy% = 0
GLOBAL footing% = 3001
GLOBAL footingx% = 114
GLOBAL footingy% = 120
loadFiles:
//LOADBMP "media/platform.jpg"
//LOADBMP "media/platform-w.bmp"
//LOADANIM "media/spritesheet.png",0
//LOADSPRITE "media/stand1.bmp",0
LOADSPRITE "media/platformloop.bmp",1001
LOADSPRITE "media/platformloop.bmp",1002
LOADSPRITE "platformloopforeground.bmp",1003
LOADSPRITE "media/stand1-1.bmp",2001
//LOADSPRITE "media/stand2.bmp",1
//LOADSPRITE "media/stand3.bmp",2
//LOADSPRITE "media/stand4.bmp",3
//LOADSPRITE "media/stand5.bmp",4
//LOADSPRITE "media/stand6.bmp",5
LOADSPRITE "media/footing.bmp",3001
loadLevel:
mainGame:
DRAWSPRITE 1001,platformx%,platformy%
DRAWSPRITE 1002,platformbx%,platformy%
//DRAWSPRITE 1003,platformax%,platformy%
//SETSPRITEANIM 0,32,32
SETTRANSPARENCY RGB (0,128,0)
//STRETCHSPRITE currentFrame%, 75, 75, 32, 32
DRAWSPRITE currentFrame%, currentFrameX% ,currentFrameY%
GETSPRITESIZE currentFrame% , currentFrameXSize%, currentFrameYSize%
DRAWSPRITE footing%, footingx% ,footingy%
IF gravity = 1
IF isFalling = 1
//IF hangTimer% = 1000 THEN hangTime% = hangTime% + 1
//IF hangTimer% > 1000 THEN hangTimer% = 1
//gForceAccel% = hangTime% * 5
gForceAccel% = hangTime% + hangTime% * 2
currentFrameY% = currentFrameY% + gForceAccel%
ENDIF
IF isFalling% = 0 THEN hangTime% = 1
IF currentFrameY% + currentFrameYSize% > 240
isFalling% = 0
ELSE
isFalling% = 1
ENDIF
ENDIF
//right pressed
IF KEY(205) = 1
rightButton% = 1
ELSE
rightButton% = 0
ENDIF
IF rightButton% = 1
currentFrameX% = currentFrameX% + jumpValX%
ENDIF
// end right pressed
//left pressed
IF KEY(203) = 1
leftButton% = 1
ELSE
leftButton% = 0
ENDIF
IF leftButton% = 1
currentFrameX% = currentFrameX% - jumpValX%
ENDIF
// end left pressed
//up pressed
//needs work to stop mid jump jumping
IF KEY(200) = 1 OR KEY(17) = 1
upButton% = 1
upButtonPressed% = 1
isFalling% = 0
ELSE
upButton% = 0
ENDIF
IF upButton% = 1
currentFrameY% = currentFrameY% - jumpValY%
ENDIF
IF currentFrameY + currentFrameYSize% = 0
upButton% = 0
ENDIF
//IF isFalling% = 0 // upButton% = 0
// end up pressed
// down pressed
IF KEY(208) = 1 AND currentFrameY + currentFrameYSize% < 240
downButton% = 1
ELSE
downButton% = 0
ENDIF
IF downButton% = 1
currentFrameY% = currentFrameY% + jumpValY%
ENDIF
IF currentFrameY + currentFrameYSize% > 240
downButton% = 0
ENDIF
// end down pressed
//directiones pressed
IF rightButton% = 1 OR leftButton% = 1 OR upButton% = 1 OR downButton% = 1
buttonpress% = 1
ENDIF
//end direction pressed
//novelty...
IF KEY(29) = 1 AND KEY(203) = 1
ROTOSPRITE currentFrame%, 100 ,100, currentFrameAngle%
currentFrameAngle% = currentFrameAngle% - 5
ENDIF
IF KEY(29) = 1 AND KEY(205) = 1
ROTOSPRITE currentFrame%, 100 ,100, currentFrameAngle%
currentFrameAngle% = currentFrameAngle% + 5
ENDIF
IF buttonpress% = 1
//RIGHT STOP
IF rightButton% = 1
jumpValX% = 5
IF currentFrameX% > 232
jumpValX% = 4
ENDIF
IF currentFrameX% > 244
jumpValX% = 2
ENDIF
IF currentFrameX% > 256
jumpValX% = 1
ENDIF
IF currentFrameX% > 268
jumpValX% = 0
ENDIF
IF currentFrameX% > 232 AND jumpValX% < 3
footingx% = footingx% - scrollValX%
platformx% = platformx% - scrollValX%
//platformbx% = platformbx% - scrollValX%
ENDIF
ENDIF
// LEFT STOP
IF leftButton% = 1
jumpValX% = 5
IF currentFrameX% < 48
jumpValX% = 4
ENDIF
IF currentFrameX% < 36
jumpValX% = 2
ENDIF
IF currentFrameX% < 24
jumpValX% = 1
ENDIF
IF currentFrameX% < 12
jumpValX% = 0
ENDIF
IF currentFrameX% < 48 AND jumpValX% <3
footingx% = footingx% + scrollValX%
platformx% = platformx% + scrollValX%
//platformbx% = platformbx% + scrollValX%
ENDIF
ELSE
ENDIF
ENDIF
//IF platformax% < 1 THEN platformbx% =960
// TOP STOP
IF currentFrameY% < 36 AND KEY(200) = 1
jumpValY% = 4
IF currentFrameY% < 24
jumpValY% = 2
IF currentFrameY% < 12
jumpValY% = 0
ENDIF
ENDIF
ELSE
jumpValY% = 5
ENDIF
IF SPRCOLL (currentFrame%,currentFrameX%,currentFrameY%,footing%,footingx%,footingy%)
downButton% = 0
isFalling% = 0
ENDIF
// animator
//IF currentFrame% > 6 THEN currentFrame% = 0
//currentFrame% = currentFrame% + 1
//PRINT "seconds" + hangTime% ,0,0
PRINT "X: " + currentFrameX% + " Y: " + currentFrameY% ,0,20
PRINT "down: " + downButton%, "up: " + upButton% ,40,0
PRINT "left: " + leftButton%, "right: " + rightButton% ,80,0
SHOWSCREEN
GOTO mainGame
Runs fine here!
i recompiled and tried again still no luck.
Is it a Windows application crash or something else ? Are you using the latest version ?
yes windows app crash and i am using v8.203
Tried it on 8.078 and that crashes too - however, there is a very good reason now I've had a proper look. V8 didn't allow functions to initialise variables (with the exception of RGB)
im sorry, i dont get it, initialise variable in function...where?
Just install V9, please. The license key works.
man after upgrade to v9 still no luck, what is wrong with my code?
is loading a file twice a bad thing? seems to be working now by not loading a pic twice?
It shouldn't be a problem unless the graphic files are corrupt or something. Can you make all of them available ?