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

#1 2012-04-12 17:05:11

st4282
New Scratcher
Registered: 2012-04-12
Posts: 7

I'm not sure how to make cheat codes.

How do u make cheat codes in a game, for example you enter red in you get 200 money

Offline

 

#2 2012-04-12 17:16:52

northmeister
Scratcher
Registered: 2011-07-12
Posts: 1000+

Re: I'm not sure how to make cheat codes.

Make a sprite ask if you have the cheat code. Then, if answer = red, give 200 money, else say 'you got it wrong.' Hope I helped  wink


http://i48.tinypic.com/5a25g5.png

Offline

 

#3 2012-04-12 17:46:33

JSO
Community Moderator
Registered: 2007-06-23
Posts: 1000+

Re: I'm not sure how to make cheat codes.

You could have the cheat ask box appear only in some special condition:
here the player has to press and hold up arrow and c pressed for 3 seconds  smile

when green flag clicked
forever
   wait until < <key [up arrow v] pressed?> and <key [c v] pressed?>>
   wait (3) secs
   if < <key [up arrow v] pressed?> and <key [c v] pressed?>>
      ask [enter secret code...] and wait
      if <(answer) = [mySecretCode]>
         say [do something!]
      end
      if <(answer) = [myOtherSecretCode]>
         say [do something else!]
      end
   end
end


http://oi48.tinypic.com/2v1q0e9.jpg

Offline

 

#4 2012-04-13 04:01:31

st4282
New Scratcher
Registered: 2012-04-12
Posts: 7

Re: I'm not sure how to make cheat codes.

JSO wrote:

You could have the cheat ask box appear only in some special condition:
here the player has to press and hold up arrow and c pressed for 3 seconds  smile

when green flag clicked
forever
   wait until < <key [up arrow v] pressed?> and <key [c v] pressed?>>
   wait (3) secs
   if < <key [up arrow v] pressed?> and <key [c v] pressed?>>
      ask [enter secret code...] and wait
      if <(answer) = [mySecretCode]>
         say [do something!]
      end
      if <(answer) = [myOtherSecretCode]>
         say [do something else!]
      end
   end
end

Thanks

Offline

 

#5 2012-04-13 06:38:45

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: I'm not sure how to make cheat codes.

or, if you didn't want them to see the cheatcode box, do

forever
if <key [space v] pressed?> //clear cheatcode
 set [cheatcode v] to []
end
if <key [a v] pressed?>
 set [cheatcode v] to (join (cheatcode) [a])
end
if <key [b v] pressed?>
 set [cheatcode v] to (join (cheatcode) [b])
end
...
if <key [z v] pressed?> 
 set [cheatcode v] to (join (cheatcode) [z]
end
if <key [up arrow v] pressed?>
 set [cheatcode v] to (join (cheatcode) [<up>])
end
if <key [down arrow v] pressed?>
 set [cheatcode v] to (join (cheatcode) [<down>]
end
if <key [left arrow v] pressed?>
 set [cheatcode v] to (join (cheatcode) [<left>])
end
if <key [right arrow v] pressed?>
 set [cheatcode v] to (join (cheatcode) [<right>]
end
if <[codes v] contains (cheatcode)>  //if you want to disable a cheatcode you can delete it from this list
 if <(cheatcode) = [something]>
  do stuff
 end
 if <(cheatcode) = [somethingelse]>
  do other stuff
 end
 ...
 set [cheatcode v] to [] //clear code so it won't trigger again
end
run this in turbo mode

Last edited by joefarebrother (2012-04-13 06:39:22)


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#6 2012-04-13 12:40:13

Optimax-DJ
Scratcher
Registered: 2010-02-15
Posts: 100+

Re: I'm not sure how to make cheat codes.

You could do this:

when gf clicked
wait until <key [r v] pressed?>
wait until <key [e v] pressed?>
wait until <key [d v] pressed?>
set [money v ] to (200)

Last edited by Optimax-DJ (2012-04-13 12:40:56)


http://desmond.imageshack.us/Himg716/scaled.php?server=716&amp;filename=optimaxdj.jpg&amp;res=medium
Treat others as you would like to be treated  smile

Offline

 

#7 2012-04-13 14:18:56

gamesman12
Scratcher
Registered: 2012-03-13
Posts: 67

Re: I'm not sure how to make cheat codes.

Sorry  for asking this on your topic but I figured out myself how to add cheats to m game, but theres one problem, is there any way to stop people seeing the cheat code if they download the game?

I use the method':

when.p. pressed:
ask. enter cheat code here. and wait.

If answer = ( my cheat code )
do something.

Offline

 

#8 2012-04-13 14:38:07

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: I'm not sure how to make cheat codes.

gamesman12 wrote:

Sorry  for asking this on your topic but I figured out myself how to add cheats to m game, but theres one problem, is there any way to stop people seeing the cheat code if they download the game?

I use the method':

when.p. pressed:
ask. enter cheat code here. and wait.

If answer = ( my cheat code )
do something.

You could use a hidden sprite and have the cheat-code asking script in it.  Very few Scratchers know how to find hidden sprites.  See this.

In my opinion, this is more ethical than forcing Scratch to quit, as people can still remix a project with a hidden sprite.

Last edited by MoreGamesNow (2012-04-13 14:39:40)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#9 2012-04-13 15:20:01

gamesman12
Scratcher
Registered: 2012-03-13
Posts: 67

Re: I'm not sure how to make cheat codes.

thanks i figured it out after a few tryes and its great thanks so much it will really help.

Offline

 

Board footer