Ultimate Amiga

Network Boards => AMOS Language Discussion => AMOS Factory => AMOS Forum => Topic started by: aszu on February 16, 2015, 02:15:50 PM

Title: Animate Bob while controlling it
Post by: aszu on February 16, 2015, 02:15:50 PM
Hi All,

I'm a Amos newbie, so please be gentle:)

I m trying to animate bob while user controls it, using just joystick. At this moment just left and right. There is a problem with the code below. The bob can be moved both sides but it does not animate.  Dont know how to do it. Help please?:)

Thanks:)
(http://i57.tinypic.com/29kp47t.png)
Title: Re: Animate Bob while controlling it
Post by: BooBoo on February 16, 2015, 05:48:12 PM
Not sure but maybe you should set the Channel first before defining the Anim and place the bob on screen before the Anim - and it could get confused with B not being defined - That is the order I would use but the short answer not sure :) but good luck and maybe someone can help.
Title: Re: Animate Bob while controlling it
Post by: Lonewolf10 on February 16, 2015, 08:21:50 PM

I agree that B should be defined before using it so you know what the value is. AMOS will give it a default value of 0, unless you define it.

I'm very rusty with Bobs, but isn't there an Update Bob command???
Title: Re: Animate Bob while controlling it
Post by: KevG on February 16, 2015, 08:54:39 PM
You are missing a semi colon ; as the last letter in the string a$.
Title: Re: Animate Bob while controlling it
Post by: aszu on February 17, 2015, 10:43:11 PM
It did not help. Will try to go through manuals:)
Title: Re: Animate Bob while controlling it
Post by: Lonewolf10 on February 18, 2015, 09:18:09 PM
I'd start by double-checking the Bob command. At a guess the format is:

Bob BOB_NUMBER,X_COORD,Y_COORD,IMAGE_NUMBER


Try commenting out that line (the one in the DO...LOOP bit). I suspect it will work then.
You will have to add the appropriate code into the A$ later to get it moving left/right as you desire.
Title: Re: Animate Bob while controlling it
Post by: aszu on February 20, 2015, 03:43:02 PM
Right,

i think i know what is going on now, but still need help. I got rid of Amal Anim and as suggested by Lonewolf10 and  just carry on with bobs.
Ive tried to use if ... then to test the image number and conseqently increase/decrease value of A, so different image would be displayed by BOB command. id doesnt work. the loop is a problem. can someone correct it and show me/ write proper loop? I ve tried the  for loop as well, but it did not work ...
(http://i60.tinypic.com/fe42lz.png)
Title: Re: Animate Bob while controlling it
Post by: Lonewolf10 on February 20, 2015, 08:35:21 PM
For your original code to work, you only needed to comment out 1 line (the one highlighted in red) for it to work:

A$="Anim 0, (1,4)(2,4)(3,4)(4,4)(5,4)(4,4)(3,4)(2,4);"
Channel B To Bob B
Bob B,120,120,1
Amal B,A$
Amal On

Do
If Jleft(1) Then BX=BX-1
If Jright(1) Then BX=BX+1

Rem Bob B,BX,120,1 : Rem this line forced bob to always be image 1!
Wait Vbl
Loop



As for your latest version, this much tidier loop will work:

Code: [Select]
Do

If Jup(1) Then Y1=Y1-1 : Dec A
If A<1 Then A=1
If Jdown(1) Then Y1=Y1+1: Inc A
If A>5 Then A=5

Bob 1,X1,Y1,A

Wait Vbl
Loop