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

#1 2008-08-17 21:04:28

zawicki1fromyoutube
Scratcher
Registered: 2008-07-31
Posts: 1000+

Enemies?

I Need To Figure Out How To add Scrolling Enemies, I need to make it so if i touch enemies I get hurt but not die, how to get touched and die, how to make it so if i jump on an enemy and they die, Etc., Etc., i tried this for the enemy dies if you jump on it: <if><touching[ sprite10<hide><<  <and>  >>[/blocks] and have it so if x position of my character = X (AKA any number) it dies, and it does not work.


|Call Of Duty: Black Ops Wii Friend Code: 3519-4456-0013|
|Follow me on Twitter|Subscribe To My Youtube Channel

Offline

 

#2 2008-08-17 22:04:51

terminator355
Scratcher
Registered: 2008-07-31
Posts: 100+

Re: Enemies?

try this:
[blocks]
<when green flag clicked>
<forever>
<if<< <touching[ sprite 10  <and> <( <y position> <=> (( yposition of sprite enemy sprite <+> what ever your sprites y position - the enemys y position )) )> >>
<broadcast[ enemy dies
<end>
<end>
and this in enemy:
<when green flag clicked>
<show>
<when I receive[ enemy dies
<hide>
[/blocks]


No new stuff for now guys  wink  join me for some Black Ops on xbox: termhn or for some rock band on PS3: rocket232

Offline

 

#3 2008-08-20 15:49:40

zawicki1fromyoutube
Scratcher
Registered: 2008-07-31
Posts: 1000+

Re: Enemies?

terminator355 wrote:

try this:
[blocks]
<when green flag clicked>
<forever>
<if<< <touching[ sprite 10  <and> <( <y position> <=> (( yposition of sprite enemy sprite <+> what ever your sprites y position - the enemys y position )) )> >>
<broadcast[ enemy dies
<end>
<end>
and this in enemy:
<when green flag clicked>
<show>
<when I receive[ enemy dies
<hide>
[/blocks]

Thank you. I will try that.


|Call Of Duty: Black Ops Wii Friend Code: 3519-4456-0013|
|Follow me on Twitter|Subscribe To My Youtube Channel

Offline

 

#4 2008-08-20 15:54:05

dingdong
Scratcher
Registered: 2007-08-09
Posts: 1000+

Re: Enemies?

ah scrolling enemies I'll give you the info in just a sec


http://img851.imageshack.us/img851/2829/superanbanner.png
click the image for my music

Offline

 

#5 2008-08-20 16:03:15

dingdong
Scratcher
Registered: 2007-08-09
Posts: 1000+

Re: Enemies?

[forever]
[if < <(scrollX) < (enemyX) + 240> and <(scrollX) > (enemyX) - 240>>]
    [show]
[else:]
    [hide]
[set X to ((enemyX) - (scrollX))]
-------------------------------------------
this is the actual location scripting
-------------------------------------------

[forever]
[if <(scrollX) > (enemyX)>]
      [change enemyX by (5)]
[if <(scrollX) < (enemyX)>]
      [change enemyX by (-5)]
--------------------------------------
this is the movement script
--------------------------------------
this is enough AI stuff to make the enemy come towards you, I suppose you already know how to do sensing for if it needs to fall to the ground or something

Last edited by dingdong (2008-08-20 16:03:33)


http://img851.imageshack.us/img851/2829/superanbanner.png
click the image for my music

Offline

 

#6 2008-08-20 19:07:02

terminator355
Scratcher
Registered: 2008-07-31
Posts: 100+

Re: Enemies?

sry didnt work for me (i tried  it)


No new stuff for now guys  wink  join me for some Black Ops on xbox: termhn or for some rock band on PS3: rocket232

Offline

 

#7 2008-08-20 19:33:36

jon182
Scratcher
Registered: 2008-08-08
Posts: 55

Re: Enemies?

add "lives. make a variable called "lives. lets say you want 3. do this.

[blocks]<when green flag clicked> <set{ lives }to(3

then when hit do this.     <change{ lives }by(-1

Offline

 

#8 2008-08-21 09:55:50

zawicki1fromyoutube
Scratcher
Registered: 2008-07-31
Posts: 1000+

Re: Enemies?

terminator355 wrote:

sry didnt work for me (i tried  it)

That's ok.


|Call Of Duty: Black Ops Wii Friend Code: 3519-4456-0013|
|Follow me on Twitter|Subscribe To My Youtube Channel

Offline

 

Board footer