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

#1 2012-07-25 02:06:51

XXtitaniumfangXX
New Scratcher
Registered: 2012-07-12
Posts: 57

damage bug

i must be bad at scripting to be posting in help with scripts so much :I  anyway i have a yeti sprite and a controlled charatcer, when you press space the character thrusts his sword and bright yellow action lines appear, the yeti is scripted to lose health when he touches this yellow. also the character can buy swords with different coloured action lines and different damages. ill try to make the scripts here

[scratchblocks]
when i recieve (broadcast)
forever
if <touching colour []>
change health by [-1]
wait [0.05] secs
end
if <touching colour []>
change health by [-1]
wait [0.05] secs
end
if <touching colour []>
change health by [-1]
wait [0.05] secs
end
if <touching colour []>
change health by [-1]
wait [0.05] secs
end
end

Offline

 

#2 2012-07-25 02:10:47

XXtitaniumfangXX
New Scratcher
Registered: 2012-07-12
Posts: 57

Re: damage bug

XXtitaniumfangXX wrote:

i must be bad at scripting to be posting in help with scripts so much :I  anyway i have a yeti sprite and a controlled charatcer, when you press space the character thrusts his sword and bright yellow action lines appear, the yeti is scripted to lose health when he touches this yellow. also the character can buy swords with different coloured action lines and different damages. ill try to make the scripts here

when i recieve (broadcast)
forever
if <touching colour []>
change health by [-1]
wait [0.05] secs
end
if <touching colour []>
change health by [-1]
wait [0.05] secs
end
if <touching colour []>
change health by [-1]
wait [0.05] secs
end
if <touching colour []>
change health by [-1]
wait [0.05] secs
end
end[/quote]

when i recieve (broadcast)
forever
if <touching colour []>
change health by [-1]
wait [0.05] secs
end
if <touching colour []>
change health by [-1]
wait [0.05] secs
end
if <touching colour []>
change health by [-1]
wait [0.05] secs
end
if <touching colour []>
change health by [-1]
wait [0.05] secs
end
end

Offline

 

#3 2012-07-25 02:14:05

XXtitaniumfangXX
New Scratcher
Registered: 2012-07-12
Posts: 57

Re: damage bug

of course the colours and damages will be different

if it is essential i can upload the first 2 (buggy) levels

Offline

 

#4 2012-07-25 02:51:07

XXtitaniumfangXX
New Scratcher
Registered: 2012-07-12
Posts: 57

Re: damage bug

bump



someone hurry up and answer i cant figure this out and im not moving on in the game until this level is flawless  > sad

Offline

 

#5 2012-07-25 13:31:21

XXtitaniumfangXX
New Scratcher
Registered: 2012-07-12
Posts: 57

Re: damage bug

oh of course no1s answering i didnt post the problem *slaps self*

anyway now i have new scripts that work better. but they still sometimes glitch out and even when im not attacking his health keeps dropping for a while, then stops

[scratchblocks]
when i recieve [begin mountains]
repeat until <(distance to [character] < [0.0001]
if <touching colour []>
change health by [-1]
wait [0.05] secs
end
if <touching colour []>
change health by [-1]
wait [0.05] secs
end
if <touching colour []>
change health by [-1]
wait [0.05] secs
end
if <touching colour []>
change health by [-1]
wait [0.05] secs
end
if <touching colour []>
change health by [-1]
wait [0.05] secs
end
end

Offline

 

#6 2012-07-25 13:40:35

XXtitaniumfangXX
New Scratcher
Registered: 2012-07-12
Posts: 57

Re: damage bug

when I receive "begin mountains"
        repeat until ((distance to s[your] ) < "0.0001") 
            if (touching color c[FFFF00]?)
                change "health" by -1
                wait 0.05 secs
end
            if (touching color c[66004C]?)
                change "health" by -3.5
                wait 0.05 secs
end
            if (touching color c[CCD9FF]?)
                change "health" by -5
                wait 0.05 secs
end
            if (touching color c[001966]?)
                change "health" by -50
                wait 0.05 secs
end
    end

Offline

 

#7 2012-07-25 13:45:47

XXtitaniumfangXX
New Scratcher
Registered: 2012-07-12
Posts: 57

Re: damage bug

 
 when I receive "begin mountains"
        repeat until ((distance to s[your] ) < "0.0001")  
            if (touching color c[FFFF00]?) 
                change "health" by -1
                wait 0.05 secs
            if (touching color c[66004C]?) 
                change "health" by -3.5
                wait 0.05 secs
            if (touching color c[CCD9FF]?) 
                change "health" by -5
                wait 0.05 secs
            if (touching color c[001966]?) 
                change "health" by -50
                wait 0.05 secs
    end

Offline

 

#8 2012-07-25 13:55:44

XXtitaniumfangXX
New Scratcher
Registered: 2012-07-12
Posts: 57

Re: damage bug

ok that didnt work ill  upload my first level if anyone wants to help they can download it and see

Offline

 

#9 2012-07-26 17:07:34

thebriculator
Scratcher
Registered: 2011-07-11
Posts: 500+

Re: damage bug

First, lets fix your blocks.
It's nice how you have everything indented here.

 
 when I receive [begin mountains v]
        repeat until <(distance to [player v] ) < [0.0001]>//put whatever ends it here
            if <touching color [#FFFF00]?> //weak sword
                change [health v] by [-1]
                wait [0.05] secs
            end
            if <touching color [#66004C]?> //medium sword
                change [health v] by [-2]
                wait [0.05] secs
            end
            if <touching color [#CCD9FF]?> //strong sword
                change [health v] by [-3]
                wait [0.05] secs
            end
            if <touching color [#001966]?> //powerful sword
                change [health v] by [-4]
                wait [0.05] secs
            end
            wait until <not<touching [sword v]?>> // this will make it only decrease once
         end

Or you can do it sprite/costume-based instead of colors.
 
 when I receive [begin mountains v]
        repeat until <(distance to [player v] ) < [0.0001]>//put whatever ends it here
wait until <touching [sword v]?>
                change [health v] by (()- ([costume# v] of [sword v]))
            wait until <not<touching [sword v]?>> // this will make it only decrease once
         end

Personally, I think this is easier. Just make the strong sword costume #4 and the weak sword #1

Last edited by thebriculator (2012-07-26 17:25:11)


.     http://tiny.cc/2cwgpw    http://tiny.cc/viwgpw    http://tiny.cc/iwwgpw

Offline

 

#10 2012-07-27 14:45:34

XXtitaniumfangXX
New Scratcher
Registered: 2012-07-12
Posts: 57

Re: damage bug

thx u helped alot  big_smile

Offline

 

#11 2012-07-27 14:56:33

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: damage bug

Or you could just have

wait until <not <touching [sword v]?>>
for only one sword.


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

Board footer