This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-08-10 23:56:42

SusannaElisabeth
New Scratcher
Registered: 2012-08-09
Posts: 5

Scrolling, Multiple Idle and Walking Animations, and some stuff.

My questions;


How do I program a 'Idle' Animation? (And multiple ones, at that)
Suppose you have a sprite. It has four different Idle animations, one for each direction and each of them has 2 frames. When you tap the left key, the Sprite (Let's call it 'Sprite A') should turn to the left and start doing a left Idle animation. Same goes for all the different directions. However, when you hold down the key, it should go to it's walking animation.

Does anyone know how to code this? If not, a <If <insert key here> Tapped> should be implemented (Only if it's possible, oh lovely Scratch Team!) :>

And how do you program a sidescrolling screen? :s

Also, collision. Lovely collision. Sprite A needs to collide with a tree because it's not a ghost. (Though that would be a lovely excuse not to have to code collision)


Thank you to anyone and everyone who helps/answers. :3

Offline

 

#2 2012-08-11 09:22:54

Zangooser
Scratcher
Registered: 2012-03-18
Posts: 1000+

Re: Scrolling, Multiple Idle and Walking Animations, and some stuff.

(To answer your first question)
For my example, just say you want the sprite to turn left, and the costumes for it facing left are the first and second costumes.

when [left arrow key v] pressed?
forever
if <<not>(costume#) = [1]>
switch to costume [left1 v]
else
switch to costume [left2 v]
change x by [-10]
Please correct me if the script is wrong, or that's not what you meant!
I'm not much of a programmer. :P


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/O0efo.png&amp;link2=http://i.imgur.com/B1KzK.png

Offline

 

#3 2012-08-11 11:25:43

SusannaElisabeth
New Scratcher
Registered: 2012-08-09
Posts: 5

Re: Scrolling, Multiple Idle and Walking Animations, and some stuff.

Thank you, Zangooser. However, I don't want it to go on forever. If it did that it wouldn't be able to switch between various animations. x)

I think I vaguely figured it out...

when gf clicked
repeat until < Left arrow key pressed > or <Right arrow key pressed> or <Up arrow key pressed> or <Down Arrow Key pressed>
switch to costume Idle Front 1
wait 0.5 seconds
switch to costume Idle front 2
wait 0.5 seconds
That's the script that tells it to do the the Idle animation from the front view when you start.

when right arrow pressed
repeat until <key up arrow pressed?> or <key down arrow pressed> or <key left arrow pressed> 
switch to costume Left Idle 1
wait 0.5 seconds
switch to costume Left Idle 2
wait 0.5 seconds
Now, when ever I click on another key, it starts glitching between the two animations.
(Say I pressed the up arrow then the left arrow; it starts glitching between both of those idle animations.)

Offline

 

#4 2012-08-11 11:46:29

daniel_j
Scratcher
Registered: 2012-05-22
Posts: 100+

Re: Scrolling, Multiple Idle and Walking Animations, and some stuff.

SusannaElisabeth wrote:

Thank you, Zangooser. However, I don't want it to go on forever. If it did that it wouldn't be able to switch between various animations. x)

I think I vaguely figured it out...

when gf clicked
repeat until < Left arrow key pressed > or <Right arrow key pressed> or <Up arrow key pressed> or <Down Arrow Key pressed>
switch to costume Idle Front 1
wait 0.5 seconds
switch to costume Idle front 2
wait 0.5 seconds
That's the script that tells it to do the the Idle animation from the front view when you start.

when right arrow pressed
repeat until <key up arrow pressed?> or <key down arrow pressed> or <key left arrow pressed> 
switch to costume Left Idle 1
wait 0.5 seconds
switch to costume Left Idle 2
wait 0.5 seconds
Now, when ever I click on another key, it starts glitching between the two animations.
(Say I pressed the up arrow then the left arrow; it starts glitching between both of those idle animations.)

Easy fix for this problem,
put this in your animation scripts (or around it):


if <key [All animation keys v] pressed?>
stop script

Last edited by daniel_j (2012-08-11 11:48:32)


http://i50.tinypic.com/2dhgnsx.jpg

Offline

 

#5 2012-08-11 11:51:55

SusannaElisabeth
New Scratcher
Registered: 2012-08-09
Posts: 5

Re: Scrolling, Multiple Idle and Walking Animations, and some stuff.

Man, I failed at writing that. ._.

Offline

 

#6 2012-08-11 12:09:05

SusannaElisabeth
New Scratcher
Registered: 2012-08-09
Posts: 5

Re: Scrolling, Multiple Idle and Walking Animations, and some stuff.

Oops, I didn't see your reply, Daniel. I'm testing it out right now.

...

It's still doing it.  hmm

Offline

 

Board footer