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

#1 2007-09-03 13:54:49

squirr3lattack
Scratcher
Registered: 2007-05-27
Posts: 11

How can I fix these problems on my project?

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

 

#2 2007-09-03 15:58:58

bigB
Scratcher
Registered: 2007-06-09
Posts: 100+

Re: How can I fix these problems on my project?

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.


http://scratch.mit.edu/projects/bigB/260981 Draw to Text
http://scratch.mit.edu/projects/bigB/181829 3D Stunt Flyer

Offline

 

#3 2007-09-03 17:06:07

Sawman3
Scratcher
Registered: 2007-07-19
Posts: 97

Re: How can I fix these problems on my project?

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!  big_smile


"These are the old days, the glory days...they're back."

Offline

 

#4 2007-09-04 20:36:47

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: How can I fix these problems on my project?

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

 

#5 2007-09-08 17:34:03

TonyHawk
Scratcher
Registered: 2007-08-15
Posts: 1

Re: How can I fix these problems on my project?

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

 

#6 2007-09-08 18:56:07

andresmh
Scratch Team at MIT
Registered: 2007-03-05
Posts: 1000+

Re: How can I fix these problems on my project?

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!


Andres Monroy-Hernandez | Scratch Team at the MIT Media Lab
on identi.ca and  twitter

Offline

 

#7 2007-09-09 10:54:56

squirr3lattack
Scratcher
Registered: 2007-05-27
Posts: 11

Re: How can I fix these problems on my project?

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

 

#8 2007-09-09 12:25:28

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: How can I fix these problems on my project?

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)


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#9 2007-09-11 14:26:27

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: How can I fix these problems on my project?

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

 

Board footer