I am trying to draw a circle and have the image update every fraction of a second.
The idea is to step through drawing a circle at 0.1 sec while pasting it to a single sprite so the circle is drawn slowly
my problem is that the image at line 72 is already created
can I append an image?
// Project: circles2d
// Created: 2017-05-15
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "circles2d" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
oox=0
ooy=0
oox2=0
ooy2=0
abtip=0
v=0
vv=0
cycle=0
ttim#=timer()
do
if cycle<100
if ttim#+0.1<timer()
cycle=cycle+1
rem width in pixels
oox=cos(vv)*105
rem height in pixels
ooy=sin(vv)*105
rem clockwise is +1 to 360
v=v+6
if v>359
v=1
endif
if v>359
vv=v-360
else
vv=v
endif
if abtip=1
drawline(oox2,ooy2,oox+201,ooy+201,200,200,200)
else
abtip=1 // first line not drawn this only runs once
GetImage(351,0,0,400,400)
CreateSprite(351,351)
SetSpriteSize(351,400,-1)
endif
oox2=oox+201
ooy2=ooy+201
render()
GetImage(351,0,0,400,400)
setspriteimage(351,351)
endif
endif
if GetRawKeyPressed(27) then end
// Print( ScreenFPS() )
Sync()
loop
As a note; this code already works but is not within the loop for updating...
// Project: circles2d
// Created: 2017-05-15
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "circles2d" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
oox=0
ooy=0
oox2=0
ooy2=0
abtip=0
v=0
vv=0
for i=1 to 100
rem width in pixels
oox=cos(vv)*105
rem height in pixels
ooy=sin(vv)*105
rem clockwise is +1 to 360
v=v+6
if v>359
v=1
endif
if v>359
vv=v-360
else
vv=v
endif
if abtip=1
drawline(oox2,ooy2,oox+201,ooy+201,200,200,200)
else
abtip=1
endif
oox2=oox+201
ooy2=ooy+201
next
render()
GetImage(351,0,0,400,400)
CreateSprite(351,351)
SetSpriteSize(351,400,-1)
do
Print( ScreenFPS() )
Sync()
loop
am I going about this correctly?