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

#1 2012-10-26 16:14:33

phdabc123
New Scratcher
Registered: 2012-10-26
Posts: 2

Variables- hit points

I'm having problems with my project, it just involves two sprites, a boss and a ship.

So far all is well, except for the fact that, when I shoot, my boss characters life points wont go down, is there a tutorial on hit points, health or anything of the sort?

Offline

 

#2 2012-10-26 17:25:26

phdabc123
New Scratcher
Registered: 2012-10-26
Posts: 2

Re: Variables- hit points

http://scratch.mit.edu/projects/phdabc123/2863170 this is the project

Offline

 

#3 2012-10-26 18:03:41

TheSupremeOverLord
Scratcher
Registered: 2012-09-29
Posts: 100+

Re: Variables- hit points

Let me take a look!


http://i1154.photobucket.com/albums/p522/lizzyhipo/MINIPIG.jpg

Offline

 

#4 2012-10-26 23:21:42

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: Variables- hit points

You want to split the collision detection and the movement scripts for the boss. Cause if it's gliding, it isn't checking to see if it's touching the bullet. So you can only hit it if it's not moving. Splitting the detection and movement should fix the problem:


when [space v] key pressed

forever  

show

glide (pick random (2) to (0.01)) secs to x: (pick random (-500) to (500)) y: (pick random (-100) to (200))

turn ccw (50) degrees


when [space v] key pressed

forever if <touching [bullet v]?>  

change [hp v] by (-1)

next costume

if <(hp) = [0]> 

hide

stop script

end

Offline

 

Board footer