プレイ日記
ShadowProX Dark.Shadow92
how can I move a 'sprite'?
6そうだね
プレイ済み
返信[1]
親投稿
L. Lohadaa
Move can mean 2 things and I assume you want to learn both. Let's start with the easier one: position change. Simply add X=X+1 for the right button and X=X-1 for the left, then add +X to your SPOFS to reflect this change. So if you press right, character moves to the right by 1 pixel per frame, same to the left. I recommend VSYNC over WAIT because of less problems. [to be cont'd...]
1そうだね
プレイ済み
返信[2]
親投稿
L. Lohadaa
The 2nd meaning of move is "animate". Our sprite skated right and left, but we'd rather have him walk. SPANIM is your friend. Try Line 4 yourself. Ignore the meaning of 0,"I" but the 6 means to switch to the next sprite in 6/60 sec like a flipbook, and the final 0 means to repeat back and forth infinitely. Now incorporate this to your buttons. Use WHILE...WEND since it's cleaner than GOTOs. [tbc.]
1そうだね
プレイ済み
返信[3]
親投稿
L. Lohadaa
Like my green text says, our sample above worked funny because SPANIM kept running whenever the left or right button is pressed, creating the illusion that it didn't animate. To solve this we need to fix the button timing in the brackets. Put 2 in for "no repeats”; we only want SPANIM to run once. Then put 3 to end animation when button is released by having SPANIM display a still image (final 1).
1そうだね
プレイ済み
返信[4]
親投稿
L. Lohadaa
And there you have it! Our sprite stands still when no buttons are pressed, and walks to the direction of the left and right buttons. I urge you to actually type in the codes in each of the pictures to see what works and what doesn't. I'm still learning this myself as well so my code may not be efficient, but at least it did the job.
1そうだね
未プレイ
返信[5]
親投稿
ShadowProX Dark.Shadow92
Thanks alot :D
0そうだね
プレイ済み
返信[6]
親投稿
L. Lohadaa
I did all the hard work, so I've got homework for ya: Make him walk up and down too, so 4 directions. You need the Y-axis, add Y, 680 and 681 for down animation, and 688 and 689 for up animation. It's optional, but I wanna see you accept da challenge :V
1そうだね
未プレイ
返信[7]
親投稿
ShadowProX Dark.Shadow92
Well give me time but i would try
0そうだね
プレイ済み
返信[8]
親投稿
Soan Soan_Sabishi
Oh man, I had this problem trying to figure this out. Thank you so much. Also, you can use #RIGHT and #LEFT in place of numbers if you forget the number. Same with #A, #B, and so on for other buttons.
3そうだね
プレイ済み
返信[9]
親投稿
ShadowProX Dark.Shadow92
@L. I really appreciate but can you tall me how to make him go up and down,please
0そうだね
プレイ済み
返信[10]
親投稿
Soan Soan_Sabishi
It's similar but instead of X values, you need Y values. Y goes up and down depending on if its - or +. It would be Y=Y+1 and Y=Y-1.
2そうだね
プレイ済み
返信[11]
親投稿
ShadowProX Dark.Shadow92
i tried it but doesn't work
0そうだね
プレイ済み
返信[12]
親投稿
L. Lohadaa
Before I help, can you please show your "tried but doesn't work" screenshot? I expect to see 4 lines each for BUTTON(), BUTTON(2), BUTTON(3), with "...AND 1..." "...AND 2..." lines already added. And of course with the Y equations implemented like Soan said. It's not hard Shadow, I know you can do it!
0そうだね
未プレイ
返信[13]
親投稿
ShadowProX Dark.Shadow92
this is the top part
0そうだね
プレイ済み
返信[14]
親投稿
ShadowProX Dark.Shadow92
the button part. The animation is running but dosen't move,why?
1そうだね
プレイ済み
返信[15]
親投稿
L. Lohadaa
Awesome job! You're practically 98% done! Hint: fix line 26. Add two characters. After you fix that, try moving up and down. That should also be an easy fix to you :)
2そうだね
未プレイ
返信[16]
親投稿
ShadowProX Dark.Shadow92
okay I would try
0そうだね
プレイ済み
返信[17]
親投稿
ShadowProX Dark.Shadow92
well I tried this but now the sprite when I press up an down goto the left or right :D (have no clue how to make it go up or down)
0そうだね
プレイ済み
返信[18]
親投稿
L. Lohadaa
Ummm... no. Ignore the 0, but 206 and 100 represent coordinates - maybe you learned that in your math class. You attached +X to 206 so that whenever left or right is pressed, the X coordinate changes from 206 to the same amount. What about the Y coordinate that is 100? What should you do to it?
1そうだね
未プレイ
返信[19]
親投稿
ShadowProX Dark.Shadow92
Thanks alot I did it :D Thanks so much!!!!!!!
0そうだね
プレイ済み
返信[20]
親投稿
L. Lohadaa
Awesome! Congrats! The reason why you needed to put -Y instead of +Y was because you accidentally flipped your equations in Lines 12 and 13 backwards. So another way is to put 100+Y but fix the signs in Lines 12 and 13. Finally, your starting point seems to be (199,100) from Line 5. Might wanna match Line 26 there.
1そうだね
未プレイ