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

#151 2011-05-26 10:29:44

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

Re: The Help Forum

naruter wrote:

i need help to make like a level (when hero comes to end of room background changes)

Code:

*Player*
wait until <touching [edge]?>
broadcast [next level]

*Stage*
when I receive [next level]
switch to background [wanted background]

Is that what you're looking for?

Offline

 

#152 2011-05-26 11:50:24

naruter
New Scratcher
Registered: 2011-05-26
Posts: 4

Re: The Help Forum

hmm

Offline

 

#153 2011-05-26 12:08:57

naruter
New Scratcher
Registered: 2011-05-26
Posts: 4

Re: The Help Forum

thx

Offline

 

#154 2011-05-27 16:09:35

likesomeguy
New Scratcher
Registered: 2011-05-27
Posts: 2

Re: The Help Forum

'sup, how do i make an enemy able to move backwards and forwards and when my sprite is touching attack, hurting my sprite also how do i make a health bar to show it and also if my sprite were to die as a result of no more health how would i be able to show it then make it start the level again?
plus, scratch is awesome.

Offline

 

#155 2011-05-28 08:21:41

likesomeguy
New Scratcher
Registered: 2011-05-27
Posts: 2

Re: The Help Forum

'sup, how do i make an enemy able to move backwards and forwards and when my sprite is touching attack, hurting my sprite also how do i make a health bar to show it and also if my sprite were to die as a result of no more health how would i be able to show it then make it start the level again, lastly, how do i program it so that when my sprite reaches the end of the screen the background changes?
plus, scratch is awesome.

Offline

 

#156 2011-05-28 12:24:27

HD123
Scratcher
Registered: 2009-12-05
Posts: 500+

Re: The Help Forum

1. To make an enemy move backwards and forwards, use this script in the enemy.

when green flag clicked
forever [
   repeat 50 [
      change x by 1
   ]
   repeat 50 [
      change x by -1
   ]
]


2. If your sprite is touching "attack" and you want it to hurt your sprite, use this script in your sprite.

when green flag clicked
set health to 50
forever [
   if <touching attack> [
      change health by -5
      wait until <not <touching attack>>
   ]
]


3.  Instead of using a health bar, I suggest you just show the health variable.


4. To show your sprite's death and then restart the level, use this script in the sprite.

when green flag clicked
show
forever [
   if <<health> less than 1> [
      go to start
      set health to 50
   ]
]


5.  When you reach the end of a level, use these scripts to change the background.  Put this script in the sprite.

when green flag clicked
forever [
   if <touching color (put end color here)> [
      broadcast NEXTLVL
      go to start
   ]
]

Put this script in the stage.

When I receive NEXTLVL
next background






I hope this helps!

Last edited by HD123 (2011-05-28 12:24:38)


~~HD123~~
Treat others as you want to be treated. |  big_smile  | http://i.imgur.com/OaNrY.gif | http://blocks.scratchr.org/libstatus.php?user=HD123&amp;online=http://lemonfanatic.webs.com/ONLINE.png&amp;offline=http://lemonfanatic.webs.com/OFFLINE.png

Offline

 

Board footer