プレイ日記
Joe josephoid
Hey guys! Im new to smile basic and ive never tried basic. Im making a clicker like game by pressing buttons for points in a certain amount of time. when i run it nothing happens though. id like some help thanks.
5そうだね
プレイ済み
返信[1]
親投稿
Aaron Krondelo
Your code isn't looping until it gets to the timer loop. You're only looping @main if you push button 32. You need a VSYNC at the end of your loop or it will run too fast. Also, you should create a function for your timer and just put that in the main loop. Create function like this: DEF TIMER TIME=TIME+1 LOCATE 1,3 ? TIME END Then just put the word TIMER in your main loop.
2そうだね
未プレイ
返信[2]
親投稿
Aaron Krondelo
Also, just start by defining a variable for buttons. B=BUTTON(2) then you can just do. IF B AND #A THEN INC X
2そうだね
未プレイ
返信[3]
親投稿
Joe josephoid
ok, ill try that
0そうだね
プレイ済み
返信[4]
親投稿
Nicole moesaku
These are the simplest changes needed to make it work: ACLS TIME=60 SCORE=0 @MAIN IF BUTTON()==32 THEN SCORE=SCORE+1 ENDIF TIME=TIME-1 CLS PRINT SCORE WAIT 1 GOTO @MAIN
2そうだね
未プレイ
返信[5]
親投稿
Joe josephoid
ok. thanks
0そうだね
プレイ済み
返信[6]
親投稿
Nicole moesaku
That said, there's some stuff that can be improved upon: You don't have to manually put in the numbers for different buttons, there's constants like #A, #B, #LEFT, #UP, and so on. Also, something like BUTTON()==#A will be true every frame that A is held down, not just the first frame it's been pressed. You can write BUTTON(2)==#A instead of BUTTON()==#A to specifically look for presses.
1そうだね
未プレイ
返信[7]
親投稿
Nicole moesaku
Keep in mind that WAIT 1 waits for just one frame, which is 1/60 of a second. Because of this, TIME=60 will only be 60 frames, which is one second. I would actually recommend using VSYNC instead of WAIT 1 here. The reasons why are kind of complicated, but VSYNC will make sure you have a consistent 60 FPS.
2そうだね
未プレイ
返信[8]
親投稿
Joe josephoid
thanks guys
0そうだね
プレイ済み
返信[9]
親投稿
V360 TheV360
Also, instead of using GOTO and GOSUB, try using WHILE and DEF WHILE X > 3 X = X - 1 WEND DEF TEST(A) RETURN A+1
1そうだね
未プレイ
返信[10]
親投稿
V360 TheV360
END (whoops forgot the end)
0そうだね
未プレイ