Ultimate Amiga

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Timers/Countdowns and animation end/start/frame referencing  (Read 3148 times)

0 Members and 1 Guest are viewing this topic.

Brick Nash

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 83
  • Generic Amiga User

I'd like to know if I'm using the Timer variable right. I'm trying to use it as a countdown so that when it reaches zero then events will be triggered. I'm not sure if that's exactly how it works or is meant to be used but I'm looking for something which will do that job.

I've given something like this a try but it doesn't seem to work

Code: [Select]
(Pre Main Loop variable set)
Timer=50

(In Main Loop)
Rem countdown activate
Timer=Timer-1

If Timer<=0
do stuff
Rem Reset timer
Timer=50
End If

I don't know if it just doesn't work, my syntax is wrong or it does work but my perception of the timer going down just misses it because it's so fast but I tried it with larger numbers and get the same thing.

Also is there a way to reference an animation end in Amal or otherwise? Such as (Pseudocode)-

- If/When animation reaches last frame in a sequence then do something

- If/When animation is on a certain frame in a sequence then do something

Obviously it'd have to reference the frame in the animation sequence and not just the sprite bank image number as there could be the same image twice in the animation sequence to give a movement effect.

If it's possible all this would be mega handy to know as branching off and triggering other things while animations are happening by way of timers or frame referencing would make the game so much easier to handle as half the time I feel I know what needs to be done and how to do it but I've no idea how to actually reference that part I want to target.

Thanks! :)
Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: Timers/Countdowns and animation end/start/frame referencing
« Reply #1 on: June 07, 2016, 09:12:41 AM »

Since you're asking a lot of questions about the programmability of Amal, I'm first going to link you to the page that tells how to store variables in an Amal program.  Your timer will likely be a counter in an external register that updates with every frame of animation and your counters will be internal registers.  Of course the special registers are the coordinates of the BOB and the frame of animation.  For instructions on how to use them, follow this link to the AmosPro manual page 07.06.04.  Also, to do parameter passing between Amal and Amos, use the AMREG function described on page 07.06.18 so you can do as much work as possible in Amal.
Logged

Brick Nash

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 83
  • Generic Amiga User
Re: Timers/Countdowns and animation end/start/frame referencing
« Reply #2 on: June 07, 2016, 09:40:27 AM »

Excellent, thanks SamuraiCrow.

As someone who suffers from both dyslexia and dyscalculia sometimes bits of manuals go over my head and don't sink in but I do read them. It just helps to have stuff pointed out! :)
Logged
Pages: [1]   Go Up
 

TinyPortal 2.2.2 © 2005-2022