Ultimate Amiga

Please login or register.

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

Author Topic: Animate Bob while controlling it  (Read 5691 times)

0 Members and 1 Guest are viewing this topic.

aszu

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 3
  • Generic Amiga User
Animate Bob while controlling it
« 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:)

Logged

BooBoo

  • Amiga Guru
  • A600
  • ****
  • Karma: 3
  • Offline Offline
  • Posts: 168
Re: Animate Bob while controlling it
« Reply #1 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.
Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Animate Bob while controlling it
« Reply #2 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???
Logged

KevG

  • A600
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 87
Re: Animate Bob while controlling it
« Reply #3 on: February 16, 2015, 08:54:39 PM »

You are missing a semi colon ; as the last letter in the string a$.
Logged

aszu

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 3
  • Generic Amiga User
Re: Animate Bob while controlling it
« Reply #4 on: February 17, 2015, 10:43:11 PM »

It did not help. Will try to go through manuals:)
Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Animate Bob while controlling it
« Reply #5 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.
« Last Edit: February 18, 2015, 09:20:32 PM by Lonewolf10 »
Logged

aszu

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 3
  • Generic Amiga User
Re: Animate Bob while controlling it
« Reply #6 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 ...
Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Animate Bob while controlling it
« Reply #7 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
« Last Edit: February 20, 2015, 08:45:19 PM by Lonewolf10 »
Logged
Pages: [1]   Go Up
 

TinyPortal 2.2.2 © 2005-2022