English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. AMOS

 
 
Thread Tools
Old 16 January 2016, 22:36   #1
aszu
Registered User
 
aszu's Avatar
 
Join Date: Mar 2014
Location: Leeds
Posts: 141
Animating explosion without amal

Hi there,

does anyone has an idea how to animate something (bob), let's say an explosion (5-6 frames) without using amal?

initially wanted go go for sth like

for a=1 to 5
bob 1,50,50,a
next a
wait vbl

it does not work and it goes straight for the last frame. i mean goes so fast, you cannot see the animation...

sounds simple but i have no clue whatsoever...
aszu is offline  
Old 16 January 2016, 22:55   #2
Lonewolf10
AMOS Extensions Developer
 
Lonewolf10's Avatar
 
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
You have the right kind of idea, but the Wait Vbl needs to be inside the loop:

Code:
for a=1 to 5
bob 1,50,50,a
wait vbl
next a
Lonewolf10 is offline  
Old 17 January 2016, 12:10   #3
aszu
Registered User
 
aszu's Avatar
 
Join Date: Mar 2014
Location: Leeds
Posts: 141
thanks, and how to slow the animation down? it is too fast using vbl and barely noticable?
aszu is offline  
Old 17 January 2016, 12:40   #4
Samurai_Crow
Total Chaos forever!
 
Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,187
Add another Wait Vbl after the first one to cut the frame rate in half.
Samurai_Crow is offline  
Old 17 January 2016, 12:49   #5
aszu
Registered User
 
aszu's Avatar
 
Join Date: Mar 2014
Location: Leeds
Posts: 141
now then, what about more complicated example. i animate background and want to draw explosion on top of it. when i use wait vbl, everything gets choppy and does not work as it should, so is there any other way?
aszu is offline  
Old 17 January 2016, 15:36   #6
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
what do you mean by "choppy"? you should always "wait vbl" every frame. if bobs are flickering, consider using double buffer.
Mrs Beanbag is offline  
Old 17 January 2016, 19:08   #7
aszu
Registered User
 
aszu's Avatar
 
Join Date: Mar 2014
Location: Leeds
Posts: 141
Quote:
Originally Posted by Mrs Beanbag View Post
what do you mean by "choppy"? you should always "wait vbl" every frame. if bobs are flickering, consider using double buffer.
i use vbl in the main routine. what i do is to scroll backgound and then and move bobs around so i cannot stick another wait vbl in the another subroutine as i already have one in main.
aszu is offline  
Old 17 January 2016, 19:11   #8
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
yes, never use two wait vbls or you'll just slow things down, but that's not what i said.

Double buffering creates two screen buffers, the bobs are drawn to the invisible buffer, and then the buffers are swapped, so you never see the screen half-way through the drawing. It prevents flickering of bobs and other animation.

If you are using "screen copy" to scroll the screen around, the bob drawing routine might get confused, because the stored background behind the bobs will be wrong, so you will need to turn "bob update off" and "autoback 0" and do manual "bob clear"/"bob draw" operations to make it work. Clear the bobs, then scroll, then draw the bobs. Then "screen swap" and "wait vbl".

Last edited by Mrs Beanbag; 17 January 2016 at 19:17.
Mrs Beanbag is offline  
Old 17 January 2016, 19:25   #9
aszu
Registered User
 
aszu's Avatar
 
Join Date: Mar 2014
Location: Leeds
Posts: 141
Quote:
Originally Posted by Mrs Beanbag View Post
yes, never use two wait vbls or you'll just slow things down, but that's not what i said.

Double buffering creates two screen buffers, the bobs are drawn to the invisible buffer, and then the buffers are swapped, so you never see the screen half-way through the drawing. It prevents flickering of bobs and other animation.

If you are using "screen copy" to scroll the screen around, the bob drawing routine might get confused, because the stored background behind the bobs will be wrong, so you will need to turn "bob update off" and "autoback 0" and do manual "bob clear"/"bob draw" operations to make it work. Clear the bobs, then scroll, then draw the bobs. Then "screen swap" and "wait vbl".
i know u did not but what i meant was it gets choppy with the second wait vbl command, otherwise everything is smooth.i use double buffering and switch the screens after drawing the background, then draw bobs. turned "bob update off" and draw them after the scroll. everything is perfect as long as i use amal. actually i just got an idea. eureka! i ll try it when i have a chance!
aszu is offline  
Old 17 January 2016, 19:37   #10
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
i still don't know what you mean by "choppy". if you add another wait vbl of course you will not have smooth animation, because it will halve the frame rate. There should only be one "wait vbl" per frame. If you want your explosion animation to run more slowly, only update its image number every other frame. For instance:
Code:
If (Timer AND 1) Inc A
Mrs Beanbag is offline  
Old 17 January 2016, 20:31   #11
Retro1234
Phone Homer
 
Retro1234's Avatar
 
Join Date: Jun 2006
Location: 5150
Posts: 5,781
Do you amal? Amal or not to Amal that is the question.
Retro1234 is offline  
Old 17 January 2016, 20:34   #12
Predseda
Puttymoon inhabitant
 
Predseda's Avatar
 
Join Date: Mar 2007
Location: Tromaville
Age: 46
Posts: 7,546
Send a message via ICQ to Predseda
Somebody does something that has animated background and explosions... mmmm, MMMM!!!
Predseda is offline  
Old 17 January 2016, 22:52   #13
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
i never found AMAL that useful, personally... at least not for animations... in Puzcat i used it for sound effects!
Mrs Beanbag is offline  
Old 17 March 2016, 23:33   #14
volvo_0ne
Registered User
 
Join Date: Mar 2015
Location: Sheffield UK
Posts: 360
I thought the only sound related command in AMAL was VUmeter ?

Isn't that more "visual"?

Just curious
volvo_0ne is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
A fantastic 2D animating tool/Kickstarter Adrian Browne News 4 02 April 2012 00:09
Kickstarter for 2D animating tool/Natami Adrian Browne Amiga scene 4 30 March 2012 22:45
jAMAL - AMOS BASIC AMAL reimplementation in Java! Mequa News 26 31 January 2012 02:12
Fake member explosion? pmc project.EAB 36 30 January 2012 14:08

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 21:21.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.13219 seconds with 15 queries