01 June 2016, 10:35 | #1 |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
|
Amal animation & HREV with joystick commands
Hi folks apologies for the more in depth post but I thought it time to actually post what I'm typing in. There may be a few mistakes as I can't get clipboard sharing to work so I had to copy the code by hand!)
I'm trying out moving my Bob with a joystick now and so far so good but I'm wondering how to go about using the joystick commands like Jup, Jright etc and using them in conjunction with my Amal animation so that it plays while the joystick is activated plus the HREV command to flip the image if Jleft is activated I can get the animation running but no joystick movement if I place the bob definition and Amal command above the joystick input loop or I can get the joystick to work but no animation (or flipping) when I put the bob definition and Amal command within the joystick loop. All the joystick commands are in there but here's some examples using just Jleft: The code below means I can move but the animation doesn't play - Code:
SX=SX-1 SX=160 : SY=100 : GUY=1 DO bob 1, SX, SY, GUY If Jleft(1) and SX>0 Then SX=SX-1 Wait VBL Loop Amal 1 "Anim 0, (1,8) etc............." Amal On Code:
SX=SX-1 SX=160 : SY=100 : GUY=1 bob 1, SX, SY, GUY Amal 1 "Anim 0, (1,8) etc............." Amal On DO If Jleft(1) and SX>0 Then SX=SX-1 Wait VBL Loop Thanks for the tolerance folks, manuals are a little hard when you have a learning difficulty and sometimes things don't sink in or click right away so I appreciate the tolerance. |
01 June 2016, 15:47 | #2 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
|
I've never used AMAL, but shouldn't your JLeft action just trigger a certain AMAL sequence to move one or two pixels?
|
01 June 2016, 18:29 | #3 |
Registered User
Join Date: Apr 2016
Location: Portsmouth
Posts: 24
|
In your first code snippet, place your AMAL commands before your loop and don't change anything else.
|
01 June 2016, 20:02 | #4 | |
Registered User
Join Date: Mar 2015
Location: Sheffield UK
Posts: 360
|
Quote:
I wouldn't bother with the REV commands unless you are short of ram as they cause no end of collision detection and "HOT SPOT" problems, It's easier to have a flipped copy of the bob in the sprite bank (unless the bob is very large of course). Last edited by volvo_0ne; 01 June 2016 at 21:59. |
|
01 June 2016, 23:46 | #5 |
Glastonbridge Software
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
|
think about the order these commands execute in.
in the first example the line "Amal 1..." never gets executed because the loop is looping forever. in the second example the line "bob 1, SX, SY, GUY" only gets called before the start of the loop, so when SX is changed it doesn't update the bob's position to the new SX. tbh i wouldn't mix AMAL with normal AMOS programming, it can only lead to confusion. Personally i never found AMAL very useful for in-game animation. |
02 June 2016, 00:16 | #6 | |
Registered User
Join Date: Mar 2015
Location: Sheffield UK
Posts: 360
|
Quote:
IF you setup & leave AMAL to get on with the movement of "enemies" in a game, and then control the Player Bob/Sprite movements, you only have Collision detection between Player & Enemy to contend with from AMOS. Obviously this depends on the game type, but USUALLY that's all you need for Lost lives or energy loss etc If the Enemy/Player interaction is more complex, then of course it's going to be more difficult. AMAL is powerful, and fast. I find that If you detect collisions between ONE player & an AMAL object, it's fast & reliable. The problem begins when you attempt to influence AMAL objects from each other, because the language isn't really designed for that.IMHO (although it can be done, but not in interrupts, which kinda goes back to the beginning) So... Animate & Move ENEMIES in AMAL but keep a close eye on your Player with AMOS(BASIC) which is MUCH easier to manipulate in realtime. Again I stress this is dependent on the game type. |
|
02 June 2016, 09:07 | #7 |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
|
Excellent info as always folks, thanks! I managed to get a the Hrev working and all the hot spots are right now too but I'll ill maybe try to animate with Amos basic today and see what happens.
It's strange to try and think of Amal and Amos as two separate languages since I've been using them both pretty much from the off in the same environment but it's certainly something I'll keep in mind in the future. Just a small couple of addition questions that I noticed that I'd like to ask - When using 'If' and 'Then' statements I know I can add other references on to 'Then by using the : but can they be continued on to another line, perhaps by wrapping in parenthesis or something similar (or is that getting a bit too modern?) For example if I were to type - If Jup(1) Then Jump : something else ... ....but continue onto this next line. I've no need for it just yet but it would just be for code tidiness. Also can I reference a bob and it's current state in an If statement? For example I noticed with my joystick controls (when it worked) that all the directions worked fine but if I was facing left (and the bob was flipped with Hrev) but then I pushed up then the bob would flip back again because that's what I have for the Jup(1) position. If I could add a second condition to tell Amos IF Jup(1) is activated AND the bob is currently in the flipped (Hrev) then to display the bob as flipped and obviously a similar one for if the bob is facing right. I tried - If Jup(1) and bob 1,SX,SY, Hrev(GUY) then bob 1,SX,SY,Hrev(GUY) Obviously that didn't work becasue it can't see a command as a reference so is there a way to do that becasue 'If' statements are pretty useful although again I'm not sure how it would work with animation but it'd be good to know if it's at least possible. Once again, many thanks from an annoying noob! |
02 June 2016, 15:01 | #8 |
Registered User
Join Date: Apr 2016
Location: Portsmouth
Posts: 24
|
In answer to your question about using multiple lines for an If statement, I suggest you do this instead:
If CONDITION=True Do this Do that Do another thing Now this End If Having more than one instruction on a single line executes slower than having a list of instructions. Regarding Hrev, I would probably just have a variable to keep track of the flipped status of the object and then check the variable.... If JUp(1)=True If ISBOBFLIPPED=True Bob 1,SX,SY,HRev(GUY) Else Bob 1,SX,SY,GUY End If End If |
02 June 2016, 18:32 | #9 | |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
|
Quote:
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Animating explosion without amal | aszu | Coders. AMOS | 13 | 17 March 2016 23:33 |
More AMAL headaches.... | volvo_0ne | Coders. AMOS | 0 | 23 February 2016 00:17 |
Want to buy a Tomahawk joystick or trade with an tac 2 joystick black box&manual | astraldimension | MarketPlace | 5 | 19 March 2015 10:55 |
jAMAL - AMOS BASIC AMAL reimplementation in Java! | Mequa | News | 26 | 31 January 2012 02:12 |
Flink v2.2 & v2.3 joystick problem | Retroplay | project.WHDLoad | 0 | 06 June 2009 15:15 |
|
|