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

#1 2012-04-21 03:21:27

SpySappinMySandvich
New Scratcher
Registered: 2012-04-21
Posts: 7

Need help with Background Transition!

So in science this term i decided to make a game with goo ol' scratch! Just need help with a few things.

1. Once you answer a question i want it to go to the next background and also remove all the sprites on that background. Understand? Eh?  tongue

2. How do i  do a multi choice like thing, i wanna know.

And 3 if its possible (doubt it XD), How do you make like an enemy that moves by itself?

If you can answer any of these, slap a reply down thar.

~Cheers

Offline

 

#2 2012-04-21 04:33:37

trinary
Scratcher
Registered: 2012-01-29
Posts: 1000+

Re: Need help with Background Transition!

1. Use broadcasts.

when gf clicked
broadcast [scene1 v]
when I receive [scene1 v]
switch to costume [scene1 v]
when I receive [scene2 v]
switch to costume [scene2 v]
^ In stage.
when gf clicked
hide
^ In every sprite.
when I receive [scene1 v]
show
when I receive [scene2 v]
hide
^ In sprites which appear in scene 1.
when I receive [scene2 v]
show
when I receive [scene1 v]
hide
^ In sprites which appear in scene 2.

You could easily extend this to many scened-projects.

2. Create different sprites, each of which have one of the choices.
Also, have a list of the correct choices (1, 2, 3).

when gf clicked
set [question# v] to (1)
broadcast [showquestion v]
^ In the stage.
when I receive [showquestion v]
switch to costume (question#)
^ In each of the 'choice' sprites.
when [choice_1] clicked
if < (item (question#) of [answers v]) = (1)>
change [correct v] by (1)
say [Correct!] for (2) secs
else
change [incorrect v] by (1)
say [Incorrect!] for (2) secs
end
change [question# v] by (1)
broadcast [showquestion v]
^ In the 'choice' sprite 1.

when [choice_2] clicked
if < (item (question#) of [answers v]) = (2)>
change [correct v] by (1)
say [Correct!] for (2) secs
else
change [incorrect v] by (1)
say [Incorrect!] for (2) secs
end
change [question# v] by (1)
broadcast [showquestion v]
^ In the 'choice' sprite 2.

when [choice_3] clicked
if < (item (question#) of [answers v]) = (3)>
change [correct v] by (1)
say [Correct!] for (2) secs
else
change [incorrect v] by (1)
say [Incorrect!] for (2) secs
end
change [question# v] by (1)
broadcast [showquestion v]
^ In the 'choice' sprite 3.

question# is a variable which determines which question it is.
The broadcast [showquestion] will show the next question.

3. There are many projects on the Scratch website which have an enemy which contains scripts for artificial intelligence.
Could you specify how you want the enemy to move, and what it should (optimally) do?


http://trinary.tk/images/signature_.php

Offline

 

#3 2012-04-21 18:54:33

SpySappinMySandvich
New Scratcher
Registered: 2012-04-21
Posts: 7

Re: Need help with Background Transition!

@Trinary, Just moving from one point and back, and if you have an "encounter" with you, you sadly die.

Offline

 

#4 2012-04-21 20:52:46

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Need help with Background Transition!

Something like this. You'd have to tweak the scripts to fit your project though.
Set the AI's rotation to "left-right".

when gf clicked //in the character
forever
  move (10) steps
  if on edge, bounce
  if <touching [character v]?>
    broadcast [die v]

when I receive [die v] //in the Stage
switch to background [sorry, you lost v]
stop all

Offline

 

#5 2012-04-22 01:47:35

SpySappinMySandvich
New Scratcher
Registered: 2012-04-21
Posts: 7

Re: Need help with Background Transition!

Thanks everyone! They worked!  big_smile

Offline

 

Board footer