Hi, I have an AI project, which I've just updated. I wanted to add the abillity to decrease and increase attack, so I created it. However, there was a problem. The Script, is basically If touching enemy and enemy costume equals attack, Change health by -1. So, I added a variable there, but I can't make a negative variable! If anyone knows how, please tell me, so the attack can be changed. Thanks! (here's a link to the project if you want to see it) http://scratch.mit.edu/projects/DrVonKitty/1161086
Offline
Offline
Well, you see, the block has a DIFFERENT variable, with the plain variable in there. I'll show you.
[blocks]<change{ai health}by( <{ attack }>[/blocks]
Offline
That turned out as a miserable block. Well, you get the point still?
Offline
positive * negative = negative
negative * negative = postive
That should help.
Offline
I know that math, but I don't know how that would make that negative. I need the Attack to be negative. If you can explain a little further, that would be nice.
Offline
wait... could [0-attack] work?
Offline
DrVonKitty wrote:
wait... could [0-attack] work?
Yes, you can either use "0 - attack" or "attack * -1" and it should work just fine.
Hope that helps!
Paddle2See made a comment earlier that it might be milliseconds faster to do a subtraction than a multiplication. He didn't seem too sure about it, though.
I commonly use "attack * -1."
Offline
Okay, I'll try that. I'll get to work on a V3 for my game now! Thanks guys!
Offline
All right! V3 is out!
Offline