プレイ日記
BeefJerkey SuperBeefJerkey
For the first time ever, there is some life in my program! But I have this problem about commands happening at the same time, thus freezing the characters in the wrong position. What would fix this?
0そうだね
プレイ済み
返信[1]
親投稿
raimondz raimondxz
I don't know how you coded your game but I guess that you didn't use a game loop pattern. The pattern look like this: While the game is running -Capture/Process the inputs. -Update the entities on the game(HP, store the next position on the map, etc) -Render the game WEND
0そうだね
プレイ済み
返信[2]
親投稿
BeefJerkey SuperBeefJerkey
Here's what I did. (I'll put the rest in other comments)
0そうだね
プレイ済み
返信[3]
親投稿
BeefJerkey SuperBeefJerkey
There's more after this.
0そうだね
プレイ済み
返信[4]
親投稿
BeefJerkey SuperBeefJerkey
This is the last of it.
0そうだね
プレイ済み
返信[5]
親投稿
raimondz raimondxz
Now I see the problem, after every input you jump straight to what you want to see, then return to the start. You need to: -Store the input for the button in a variable.(VAR B=BUTTON()) -Compare using AND instead of ==(IF B AND #UP). -Store the changes on a variable(DELTAY=-1) -Then, change the sprite position( VAR X,Y SPOFS 1 OUT X,Y SPOFS 1,X,Y+deltaY )
0そうだね
プレイ済み
返信[6]
親投稿
BeefJerkey SuperBeefJerkey
Not understanding this so well. I'm just a beginner. I know what the problem is, I just didn't know how to do it right. And I'm not exactly sure how to put this in, what you're telling me. Sorry. Could you try to explain a little more clearly, if you don't mind?
0そうだね
プレイ済み
返信[7]
親投稿
mystman12 mystman12
Another thing you should do is use GOSUB instead of GOTO. GOSUB works the same as GOTO, except you can then use RETURN to make the code return to where the GOSUB was called. For example... GOSUB @WOW PRINT "BOB" END @WOW PRINT "HELLO " RETURN This will print "HELLO BOB" on-screen. You should use this technique for all the input commands instead of the GOTO @DODGE and then...
0そうだね
プレイ済み
返信[8]
親投稿
mystman12 mystman12
GOTO @START method you are currently using.
0そうだね
プレイ済み
返信[9]
親投稿
BeefJerkey SuperBeefJerkey
@mystman, Thanks, but now it would take quite a while to change it to that, so I'll just keep it this way. Thank you for telling me, though.
0そうだね
プレイ済み
返信[10]
親投稿
こうやま kouyama1435
You have to study DIM and Array,and you can become shorter program.For example: SP=8:DIM SC[SP],SS[SP],SX[SP],SY[SP] FOR I=0 TO SP-1:READ SC[I],SCX[I],SCY[I],SX[I],SY[I]:SPSET I,0:NEXT DATA (Value),(Value),(Value)... DATA (Value),(Value),(Value)... FOR I=0 TO SP-1 SPCHR I,SC[I] SPOFS I,SSX[I],SSY[I] SPOFS I,SX[I],SY[I] NEXT
0そうだね
未プレイ
返信[11]
親投稿
BeefJerkey SuperBeefJerkey
I don't know how that stuff works. But I have come up with a reliable way to do it with variables. I think I've got it now.
0そうだね
プレイ済み
返信[12]
親投稿
mystman12 mystman12
That's cool! I'd say most of what you'll learn about programming will come from your own experiments, and picking up on better techniques and more efficient ways to program.
0そうだね
プレイ済み