|
Forum Index : Microcontroller and PC projects : animation demo's
| Author | Message | ||||
| Peter63 Senior Member Joined: 28/07/2017 Location: SwedenPosts: 153 |
I made a simple animation that I did in Paint.NET. Try it out and give comments on how it can be improved. I might be programming completely wrongly or unnecessarily. Change the program and give suggestions on how it can be written instead. ![]() jump-v3.zip (using PicoMite MMBasic) /Peter63 Edited 2026-04-19 12:45 by Peter63 |
||||
| Peter63 Senior Member Joined: 28/07/2017 Location: SwedenPosts: 153 |
I have increased from 6 sprites to 24 sprites. Front, Right, Left, Back - sprite. To get a bit more realistic movement. ![]() new version program jump-v5.zip /Peter63 |
||||
| Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1447 |
Of course, there’s still plenty of room for improvement, but it’s a rather sweet idea ![]() 'no comment |
||||
| Peter63 Senior Member Joined: 28/07/2017 Location: SwedenPosts: 153 |
a little hair and a little hat, version 9 ![]() jump-v9.zip /Peter63 |
||||
| Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1447 |
Just a quick tip for optimisation A large proportion of your sprites are identical, so if you split your sprites into two elements, you can save quite a lot of memory. ![]() Horizontally, the face remains the same; vertically, the spring. That way, 10 sprites would be enough for everything; if you mirror the left/right face, you’d only need 9 Edited 2026-04-20 00:34 by Martin H. 'no comment |
||||
| Peter63 Senior Member Joined: 28/07/2017 Location: SwedenPosts: 153 |
Hello, Martin Yep, you're right, optimization is needed to minimize memory usage. Thank you for your feedback, I appreciate that. Then I don't really know how to optimize the program code, someone who is good at it is welcome to give suggestions. /Peter63 |
||||
| Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1447 |
Peter, Functionality comes before optimisation First of all, it’s important that you manage to turn your thoughts into a programme that actually does what you want it to do. ' --- main loop --- Do k=Asc(Inkey$) If k=27 Then Exit Do If k=32 Then ' space = compress jump compress_jump x,y,30 End If If k=128 And y>50 Then ' up arrow y=y-8 compress_jump x,y,30 End If If k=129 And y<200 Then ' down arrow y=y+8 compress_jump x,y,30 End If If k=130 And x>8 Then ' left arrow x=x-8 compress_jump x,y,30 End If If k=131 And x<300 Then ' right arrow x=x+8 compress_jump x,y,30 End If Loop You could certainly do it that way; I’d actually prefer to replace it like that (untested). do nope=0 k=Asc(Inkey$) Select case k Case 27 Exit do Case 32 ' space = just compress jump case 128 ' up arrow Inc y,-8*(y>50) Case 129' down arrow inc y,8*(y<200) Case 130 ' left arrow inc x,-8*(x>8) Case 131' right arrow inc x,8*(x<300) case else nope=1 end select if not nope then compress_jump x,y,30 Loop and even that can be optimised further Its all related to your Version V3 But it’s a learning process, so give it a go your own way. That way, the sense of achievement will feel more genuine. Cheers Martin Edited 2026-04-20 05:04 by Martin H. 'no comment |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |