Alright, whats up guys. I'm working on a Stick person boxing game. I have a couple of questions. And I haven't Stratch'd in a while so please, stay with me.
1. How do I make it so when the player presses "X" key, the character switches to a blocking costume, and as long as they are holding down "X" key, the character is blocking, but as soon as the key is let go of, the character isn't blocking.
2. How can I refuse the player the right to holding down the "X" key (blocking) and while holding "X", they can tap "Z" key to make a hit without taking damage?
3. What should I do to represent character health?
4. How can I make a line of words like "Black Sprite Wins"?
5. When one character is out of health, how do I code a "Finish Him"- like senario?
Thanks for the help.
Offline
i'll try to help. there are more than one way to do each of those. my suggestion might not be the best but ill try.
1. when green pressed
forever
if X pressed
switch to costume Blocking
else
swith to costume not blocking.
2. the damage needs to be done in the one that is been hit not the one that is hitting. a variable called blocking may be useful.
3. a variable called health would be the most common method. set it to a certain number at the start and when ever the character gets injured change it by a negative number. if health less than 0 hide, could be used for when it dies.
4. a seperate sprite which says black sprite wins could start off hidden and appear when the other sprite dies.
5. im not really sure what you want for 5. do you mean an animation of him dying?
i know that wasnt very detailed but i hope some of it helped.
Offline
Ah--the FINISH HIM scenario. If I understand correctly you want a sort of few-second cut scene when your opponent is about to collapse where you can use a powerful combo to drop him. To do this, you can simply create many more costumes for each motion, so that the transition from standing still to punching is slowed--this will create a nice slo-mo effect. Perhaps add some sort of skill mini-game for the combo, so that you, say, have to (just an example) click really fast for five seconds to drop your opponent. If you don't get a certain number of hits in, he recovers. This would be great if the slo-mo was only on your reeling opponent, and could be achieved with a simple *punches* variable that kept track of how many hits you threw in that situation. Finally, the screen zooming in a bit with a nice sort of colored (perhaps red) halo about the players would really make a nice polished effect for your Finish-Him minigame. Hope that helps!
Offline
You probably don't want a forever loop that just keeps testing the variable "blocking".
Try
<forever>
<wait until><( blocking <>> 0 )>
<switch to costume[ BLOCKING
<wait until><( blocking <=> 0 )>
<switch to costume[ NOT-BLOCKING
<end>
Offline
i need help making a platform game please c'mon i reeeeaalllyyy need some help coz i made it the dude can stand on colored surfaces sort of but not really he does really stand on it that good but oh well just some one help me
Offline
TonyHawk: I think if you post your question on a new thread instead of using this one you have more chances of getting help. Make sure to use a title that describes your problem. For example: "help with platform game: dude doesn't stand on surface".
Also, more people will answer if you post a link to your project (even if it is not working) and say. Then people can tell you "oh you are missing this and that".
Don't forget to divide the problem in smaller pieces. For example, you could focus on getting your dude to jump first, then to stand on platforms, if you get stuck in one of the smaller goals then you post a message asking for help on how to do that specific thing.
Thanks for using Scratch and... Scratch on!
Offline
kevin_karplus wrote:
You probably don't want a forever loop that just keeps testing the variable "blocking".
Try
<forever>
<wait until><( blocking <>> 0 )>
<switch to costume[ BLOCKING
<wait until><( blocking <=> 0 )>
<switch to costume[ NOT-BLOCKING
<end>
What number/code should I use to represent blocking/not blocking with the green variables?
Offline
Kevin's code requires another script that controls the blocking variable. A script like this.
<when[ x]key pressed>
<set{ blocking }to(1)
<wait until> << <not><key[ x ]pressed?> >>
<set{ blocking }to(0)
This code when paired with kevin's code will make you character "block"
However, that all is unnecessary and the following code I think is more efficient.
<when green flag clicked>
<forever if><key[ x]pressed?>
<if><(<{ canheblock }> <=> 1 )>
<set{ blocking }to(1
<switch to costume[ blocking
<wait until><< <not> <key[ x ]pressed?>>>
<switch to costume[ not blocking
<set{ blocking }to(0
Last edited by archmage (2007-09-09 12:29:06)
Offline
Archmage's code looks ok if one assumes that "blocking" is exactly the same as having key x pressed. Indeed it would be more efficient to do it his way if that is the case.
Offline