07 June 2016, 08:31 | #1 |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
|
Pieceing together different images to make an animation
I've seen some games use memory efficient tricks like making an animation by tacking certain images on to a main static image.
There's a section in one of the Amos manuals that describes something similar to this but doesn't really give examples so would this be achieved by having a second bob flash on the screen with one image while the main one runs it's animation but synced up co-ordinate wise so they appear as one? Or maybe something different involving some cleverly loaded tiles? For example in the image below you can see that the body of the man during this punch is the same image and only the arm section is actually changing. (I know it's a Megadrive game but the point is the same!) It's something I've noticed in games for years and been curious about so it'd be nice to know the Amos way of doing it. Also regarding animation, is it possible to perhaps write your own animation tool? Or is there another available maybe via extension? Amal does it's job very well but I'm finding it a little restrictive in that it only seems to work with other Amal functions/commands instead of in tandem with Amos Basic. (This could just be my inexperience but regardless it's nice to know!) Once again many thanks to all on the forum who've been a great help through my relentless questions which seem top have swamped this section. I feel I'm making leaps and bounds and I already have somewhat of a fully controllable and working player on screen with joystick activated animation which I thought would be impossible last week! |
07 June 2016, 10:49 | #2 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
|
You save a lot of memory by using the above method, and at times, also some speed. It's no more difficult than what you see in the picture:
Bob 1,player_x,player_y,1 Bob 2,player_x+player_width,player_y+20,4 You can certainly make your own animation tool, and it isn't that hard either. Usually you just rip away the game elements from your game, add mouse support and you have an editor. What you must decide on once you've done that is how to store your animations – should they be AMAL strings, some complex text format, some binary format, and so on? Furthermore, what needs to be stored in an animation sequence and what can be skipped? How do you put together several animations? |
07 June 2016, 11:09 | #3 | |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
|
Quote:
As for the animation that's cool to know for the future. Maybe I'm doing it wrong but I do find Amal to be powerful but also quite picky in terms of movement with the animation concerning transitioning from horizontal/vertical movement to diagonals and looping a movement to infinity with the joystick instead of a set number of steps then stop. Sometimes the way that it likes things to be ordered means a lot of duplicated code too where as if the sequence didn't matter it would be much better. It doesn't matter as right now I'm just happy to get things running so it doesn't matter if it's particularly efficient just yet. Thanks for the info, I'll give this a try right now! |
|
07 June 2016, 11:16 | #4 | |
Total Chaos forever!
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,186
|
Quote:
|
|
07 June 2016, 12:22 | #5 | |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
|
Thanks I'll have a read of those today.
Quote:
Obviously using just X and Y will be it's own co-ordinates so how would I actually bob 1's X and Y to tell bob 2? Thanks again for all the help. I'm really quite chuffed with the progress I'm making thanks to everyone here. |
|
07 June 2016, 14:50 | #6 | |||
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
|
Quote:
Quote:
Quote:
|
|||
07 June 2016, 15:10 | #7 | |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
|
Quote:
If I type in - Bob 2,X,Y,8, It'll just call Bob 2's current position (which would be it's first position too) and not Bob 1's current position who could have moved across the screen by then. I know this is wrong so take it as sort of pseudo code but something like Bob 2, BOB1's X,BOB1's Y,8 Just something to type in those X and Y positions that will reference the current X and Y position of Bob 1. I tried making custom variables for both so I could switch in and out but it didn't seem to work. In Game Maker I do it by putting an object's name and then .X or .Y such as ObjectEnemy.X and that returns the X value of the object it's name is attatched to so I can use it to sync movement between two objects with something like For Player 1 X=ObjectEnemy.X Y=ObjectEnemy.Y So player 1's X & Y will now exactly follow ObjectEnemy. I know it'll be done differently in Amos but the result is the same and it's just what to type in that's sort of baffling me. |
|
07 June 2016, 15:33 | #8 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
|
Just store bob 1's X and Y coordinates in two variables. You can call them COCACOLA and PANTALOON if you wish, or just X and Y. Then you can use those variables for any bob.
|
07 June 2016, 16:11 | #9 | |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
|
Quote:
I don't think I'm doing it right. I initialised the variables in the variables section then I used them to initialise the bob before the main loop and then when Bob 2 is called to appear in the procedure I used them there but no joy. I made sure the variables were shared in the procedure as well How exactly do you store Bob 1's X and Y coordinates in the custom variables? It's can't be X=POSX because X would be individual to each bob wouldn't it and would just be calling on it's own co-ordinates and storing them? Sorry I feel really stupid asking the same thing, it's my fault I know I'm slow and I do appreciate the patience. |
|
07 June 2016, 17:16 | #10 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
|
There is no magical X or Y thing. They're just variables like anything else. You can write BLAHBLAH instead of X or Y and the same thing will happen.
|
07 June 2016, 18:54 | #11 |
Total Chaos forever!
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,186
|
If you set the hotspot of the BOB to the bottom-center of the character image, Amos will do the offsets for you.
|
07 June 2016, 19:46 | #12 | |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
|
Quote:
Right here's how I've done it - I initialise my custom variables then Bob 1 with the custom variables Pre main loop POSX=100 POSY=140 Bob1,POSX,POSY,1 I do the joystick inputs in the loop but I leave the blank spaces so it can change whatever info it needs to like position and image. Bob1,,, etc, Then I hit fire and that goes to a procedure outside the loop where I shared the POSX and POSY variables then when I call Bob 2 I use the variables as such which I assumed would give me the stored position of Bob 1 - Bob 2,POSX,POSY,8 Bob 2 appears fine but if I move my player across the screen and press fire again Bob 2 appears in the place it was before and not where Bob 1 is now. Sorry I know I'm a dummy and there's just something I'm not seeing. BTW I'm using 'Move X' to move the player with the joystick if that makes any difference? That's handy to know thanks. I've got my own markers that I use for frame syncing which I use when importing. It's just a small green square at the top Left of each frame so if I get that in the top corner when I grab the images in then everything animates perfectly. |
|
07 June 2016, 21:08 | #13 |
Registered User
Join Date: Apr 2016
Location: Portsmouth
Posts: 24
|
It sounds to me that you are seeking to create relationships between Bobs and variables or that you believe variables will change based on the movements of other bobs. This is not so.
In game engines like Game Maker you can define game objects with properties like .x or .y with behaviours like auto updating properties based on changes in the other game object properties. In Amos, none of that will happen. The Bob instruction simply tells Amos to paste a predefined block of graphics onscreen at specified coordinates. You can use numbers, variables and expressions to define your coordinates. Lets say our bobs are 16x16 and we want Bob 1 on top Bob 2: X=100 Y=100 Do If Jup(1)=True and Y>0 then Dec Y Bob 1,X,Y,1 Bob 2,X,Y+16,2 Wait Vbl Loop ...would accomplish this. Bob 1 is positioned at coordinates X,Y and Bob 2 is positioned at coordinates X,Y+16. As you moved the joystick up, Bob 2 will always stick to the bottom of Bob 1. You would need to add more code for movement left, right and down. |
07 June 2016, 21:31 | #14 | |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
|
Quote:
I did try what you suggested above and a lot of other combinations too but Bob 2 still stays in the same place. I think it's because I'm using the Move X/Move Y commands to move my Bob 1 Amal animations and I don't think that STOS commands take into account stored co-ordinates as I think they work separately like Amal does. Again I could be wrong but I have some proper reading to do courtesy of SamuraiCRow as I think that bridging that gap will help matters a lot. Once again thank you for the mountains of help and patience everyone, it's very much appreciated! |
|
07 June 2016, 21:39 | #15 |
Registered User
Join Date: Apr 2016
Location: Portsmouth
Posts: 24
|
Yes. As I said, there is no relationship there. Amal has it's own separate variables for tracking a Bobs X and Y. It will not make changes to a variable in Amos and you cannot define a relationship.
After moving a Bob with Amal, you need to pull its coordinates back into Amos using the Amal register functions. However, remember that Amal programs execute independantly of Amos so by the time Amos completes the instructions needed to do this, your Bob may have already moved to a new location. |
07 June 2016, 21:49 | #16 | |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
|
Quote:
|
|
07 June 2016, 21:53 | #17 |
Registered User
Join Date: Apr 2016
Location: Portsmouth
Posts: 24
|
That should be fine. If no Move commands are being executed by Amal when you process the instructions to grab coordinates for your second bob then you'll get an accurate result.
|
08 June 2016, 16:03 | #18 |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
|
I'm just thinking....I'm using the STOS Move X/Move Y commands with my joystick inputs to move my Amal animations because I couldn't find a way to make the actual Amal Move command move continuously. It would always stop at the end set by the step parameter (in the STOS Move X/Y you just put an L at the end of the string to make it loop so it moves forever if the joystick is pushed in a direction) and there is nothing that I can see in the documentation about something similar for the Amal Move command.
Anyway, are the values in the STOS commands able to be stored in the AMAL registers and recalled with Amreg? It just struck me that they may not be compatible. |
08 June 2016, 18:42 | #19 |
Registered User
Join Date: Apr 2016
Location: Portsmouth
Posts: 24
|
I don't know on this one I'm afraid, you could test it yourself by pulling the X coord out of an Amal channel, running a Move X command then pulling the X coord again and see if it's changed.
|
08 June 2016, 21:28 | #20 |
Phone Homer
Join Date: Jun 2006
Location: 5150
Posts: 5,773
|
I dont think Amal is faster unless your using 68020+ I also dont think Amos is much slower than other options once compiled - Amal makes things simplar writing a complex movement routine handling many Bobs is much more complicated than using Amal - the Amiga is "slow" compared to?....... consoles? and there many sprites this has been said and done so many times the amiga and the scene are borring - show me a demo of blitz running faster or any other similar language.
Last edited by Retro1234; 08 June 2016 at 21:33. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
animation software | moijk | support.Apps | 3 | 25 March 2013 17:36 |
Is it possible to get this demo/animation? | TTD | request.Demos | 2 | 22 October 2011 19:04 |
Boing Animation | Fingerlickin_B | request.Demos | 8 | 27 February 2009 14:45 |
How to make iBrowse load images to Fast RAM? | Fingerlickin_B | support.Apps | 2 | 23 February 2009 06:11 |
Name of animation? | Drake1009 | Retrogaming General Discussion | 7 | 10 December 2001 13:00 |
|
|