Improve My Code

BlitzMax Forums/BlitzMax Beginners Area/Improve My Code

Rambo_Bill(Posted 2005) [#1]
If anyone wants to help, what I have so far is at:
(Open Test.bmx)
http://www45.brinkster.com/QuickSetup/default.htm
(Open Test.bmx)



Let me know of any improvements...
It may also help other beginners to see it. Oh, and I noticed my images skip from 9 to 11, but thats the image not the program. I realize it's very small and simple, but I figured best to improve before it gets too big and too hard to look over.

WHAT IS IT?
It's a 2D Sprite Engine with Basic animation and movement scripting.


Rambo_Bill(Posted 2005) [#2]
Be gentle, this is only my third day with BlitzMax.


altitudems(Posted 2005) [#3]
I'm sort of struggling to understand what your trying to accomplish here? Can you give me any insight as to what you want to use this for. There may be a simpler way.


Rambo_Bill(Posted 2005) [#4]
Altitudems:
Firstly, Does the code work on your PC?
I'm really just looking to improve what I already have (Sprite engine with scripting for movement and animation). I'm trying to make a shorthand way of controlling images. Like this:
L 1:M 150,0,.5,0:M 0,150,0,.5:M 150,0,-.5,0:M 0,150,0,-.5:J 1

That defines a path of a square, then jumps back.

Hopefully you get the idea, some may not like this style for creating games, But I do.
Keep in mind not just one SAM object would be going as in the Example, but hundreds for all the game images.


altitudems(Posted 2005) [#5]
Your code works fine as is. But I'm curious too see how it will perform with the hundreds of objects you mentioned. Don't get me wrong every programmer needs to do things their own way, but it seems to me that using your current method, there is a lot of required code to produce a simple result. Are you trying to create some kind of scriptible AI? I still think there is a simpler way to achieve the same effect. If I get some time I'll post some code.

-- For some reason your code reminds me of ZZT's OOP :)


Rambo_Bill(Posted 2005) [#6]
20 lines of code is alot to have those sprites moving like that? And it's not even cleaned up. I can cleanup how the types work and get it down to 10 lines. I can see how some would find this style not their style,But I think you'd see the benefits when you have lots of objects following different paths made in SAM.


Rambo_Bill(Posted 2005) [#7]
want to see how well it works with lots of sprites? Try this replace the for loop with this one:


Starting a worklog, instead of spamming here. should have done that from the start :)

Still smooth as butter on my system.

or to see more replace all the code in test.bmx with this: