Hi All,
I've been experimenting with the AGK2 as a beginner.
Just made a Dice.
Simple graphics made with AGK2, no painting program is needed.
Just for fun, free to use the code and to let the beginners know how to make a simple app.
You can optimize te code, becouse the dots are at the same places (maybe with a function?).
Have fun with it and show us some (dicing) games what you made of it with this dice here (would be fun).
// Project: dice
// Created: 2015-08-13
// set window properties
SetWindowTitle( "dice" )
SetWindowSize( 800, 600, 0 )
// set display properties
SetVirtualResolution( 800, 600 )
SetOrientationAllowed( 1, 1, 1, 1 )
CreateSprite(100,0)
color1=MakeColor(245,245,225)
color2=MakeColor(200,200,125)
color3=MakeColor(175,175,125)
color4=MakeColor(245,245,200)
color5=MakeColor(10,10,10)
color6=MakeColor(100,100,100)
//dice one
DrawBox(0,0,100,100,color1,color2,color2,color3,1)
DrawEllipse(50,50,48,48,color4,color4,1)
DrawEllipse(50,50,10,10,color5,color6,1)
swap()
dice=GetImage(0,0,100,100)
ClearScreen()
dice1=createsprite(dice)
SetSpritePosition(dice1,100,50)
AddSpriteAnimationFrame(100,dice)
` DeleteSprite(dice1)
//dice two
DrawBox(0,0,100,100,color1,color2,color2,color3,1)
DrawEllipse(50,50,48,48,color4,color4,1)
DrawEllipse(25,25,10,10,color5,color6,1)
DrawEllipse(75,75,10,10,color5,color6,1)
swap()
dice=GetImage(0,0,100,100)
ClearScreen()
dice2=createsprite(dice)
SetSpritePosition(dice2,200,50)
AddSpriteAnimationFrame(100,dice)
` DeleteSprite(dice2)
//dice three
DrawBox(0,0,100,100,color1,color2,color2,color3,1)
DrawEllipse(50,50,48,48,color4,color4,1)
DrawEllipse(25,25,10,10,color5,color6,1)
DrawEllipse(50,50,10,10,color5,color6,1)
DrawEllipse(75,75,10,10,color5,color6,1)
swap()
dice=GetImage(0,0,100,100)
ClearScreen()
dice3=createsprite(dice)
SetSpritePosition(dice3,300,50)
AddSpriteAnimationFrame(100,dice)
` DeleteSprite(dice3)
//dice four
DrawBox(0,0,100,100,color1,color2,color2,color3,1)
DrawEllipse(50,50,48,48,color4,color4,1)
DrawEllipse(25,25,10,10,color5,color6,1)
DrawEllipse(75,25,10,10,color5,color6,1)
` DrawEllipse(50,50,10,10,color5,color6,1)
DrawEllipse(25,75,10,10,color5,color6,1)
DrawEllipse(75,75,10,10,color5,color6,1)
swap()
dice=GetImage(0,0,100,100)
ClearScreen()
dice4=createsprite(dice)
SetSpritePosition(dice4,400,50)
AddSpriteAnimationFrame(100,dice)
` DeleteSprite(dice4)
//dice five
DrawBox(0,0,100,100,color1,color2,color2,color3,1)
DrawEllipse(50,50,48,48,color4,color4,1)
DrawEllipse(25,25,10,10,color5,color6,1)
DrawEllipse(75,25,10,10,color5,color6,1)
DrawEllipse(50,50,10,10,color5,color6,1)
DrawEllipse(25,75,10,10,color5,color6,1)
DrawEllipse(75,75,10,10,color5,color6,1)
swap()
dice=GetImage(0,0,100,100)
ClearScreen()
dice5=createsprite(dice)
SetSpritePosition(dice5,500,50)
AddSpriteAnimationFrame(100,dice)
` DeleteSprite(dice5)
//dice six
DrawBox(0,0,100,100,color1,color2,color2,color3,1)
DrawEllipse(50,50,48,48,color4,color4,1)
DrawEllipse(25,25,10,10,color5,color6,1)
DrawEllipse(75,25,10,10,color5,color6,1)
` DrawEllipse(50,50,10,10,color5,color6,1)
DrawEllipse(25,50,10,10,color5,color6,1)
DrawEllipse(75,50,10,10,color5,color6,1)
DrawEllipse(25,75,10,10,color5,color6,1)
DrawEllipse(75,75,10,10,color5,color6,1)
swap()
dice=GetImage(0,0,100,100)
ClearScreen()
dice6=createsprite(dice)
SetSpritePosition(dice6,600,50)
AddSpriteAnimationFrame(100,dice)
` DeleteSprite(dice6)
rem put the dice on the screen
SetSpritePosition(100,300,200)
rem make it bigger
SetSpriteScale(100,1.5,1.5)
rem maak the back screen green (can be removed)
SetClearColor(1,75,1)
rem change the color of the dice, remove the ´rem´ in front of the next line.
rem SetSpriteColor(100,200,50,50,255)
do
if (GetPointerPressed()=1 and pressed = 0)
SetRandomSeed2(Timer())
StartTimer#=timer()
pressed = 1
PlaySprite(100)
endif
if (pressed = 1)
if (Timer()>StartTimer#+1)
StopSprite(100)
SetSpriteFrame(100,Random(1,6))
pressed=0
endif
endif
` Print( ScreenFPS() )
` Print( Timer() )
` Print( GetSeconds() )
` Print( StartTimer# )
Sync()
loop
You can delete the 6 images by removing the `-sign in the code before 'DeleteSprite(...)'.
someone can tell me more about ramdomseed and randomseed2?