Discuss Scratch

Remix_Master786
Scratcher
14 posts

Need help for an RPG game

So I have been working on a rpg game and something isn't right with the enemys hiding and showing and I know its something about the script. I am not that great at coding but I was really confident my game would come out good but I dont think so anymore… tryed adding new enemys and cant fix it. If anyone can help me with this here is the code https://scratch.mit.edu/projects/788516491/
Danifh_XD
Scratcher
11 posts

Need help for an RPG game

Uhh… You go to the enemy sprite and replace the script of the “when green flag clicked” that has “if level = 6” with this script:
whenclickedforeveriflevel=6thenshowgotox:59y:86iftouchingplayerthenbroadcastfightgoback5layerselsehidewaituntilnotlevel=6iftouchingplayerthenhidebroadcastfight
Remix_Master786
Scratcher
14 posts

Need help for an RPG game

I tryed that and then it wont show up on level 7 nor 9
waitwhat2288
Scratcher
100+ posts

Need help for an RPG game

Hi! I think this should work. Make sure to add a “Next Level” boolean variable once the arrow is clicked.

whenclickedforeveriflevel=6orlevel=7orlevel=9thenshowgotox:59y:86iftouchingplayer?thenbroadcastfightgoback5layerselsehidewaituntilNextLeveliftouchingplayer?thenhidebroadcastfight
Remix_Master786
Scratcher
14 posts

Need help for an RPG game

Alright, but what should I add to define that boolean variable?
defineNextLevel
waitwhat2288
Scratcher
100+ posts

Need help for an RPG game

Sorry for the late reply, I might have accidentally said “boolean variable” instead of “binary value.” (Boolean variables are true and false statements, but they are used to classify custom blocks, so that's why I got confused.) If you're not sure what a binary value is, it is a variable that only has 2 outcomes, 1 and 0, or true and false. So replace the “Next Level” block to this:

waituntilNextLevel?=1

And to do that, whatever you are going to make it so you progress is, which I'm going to use the arrow sprite for this example, you want to add this script in the arrow sprite:

whenthisspriteclickedsetNext Level?to1wait0secssetNext Level?to0

Make sure to make the Next Level? variable set to 0 once the game starts too.
Remix_Master786
Scratcher
14 posts

Need help for an RPG game

I think I get it now… could you remix it so I can see what to fix? My computer mixes up everything and it so confusing to read the blocks off of this.
waitwhat2288
Scratcher
100+ posts

Need help for an RPG game

I'm trying not to remix any projects by the end of 2023 because I don't want anybody who follows me to be notified with unnecessary messages of me remixing a project. I'll just be going over a procedure, which will probably be slower, sorry if this causes some inconsistency.

First, make a binary value named “Next Level?” or something like that.

Second, go to the enemy sprite.

Third, go to the Next Level value in the wait until block and replace it with a Next Level? = 1 operator.

Fourth, go up to the level = 6 operator that is connected to the if block, make it so if level = 7 and level = 9 can also activate the block using or statements.

Fifth, go to the arrow sprite.

Sixth, add a when this sprite is clicked block.

Seventh, add a set Next Level? to 1 block under the previous block placed.

Eighth, add a wait 0 seconds block under the previous block placed.

Lastly, add a set Next Level? to 0 block under the previous block placed.

Powered by DjangoBB