Discuss Scratch

Mikkerix
Scratcher
10 posts

I need help from you scratchers!

I realy need help with complicated coding, and I need the help from you! I have tried to solve the problem several times, so please help me. The problem is adressed in the info section of the game. Ask me if you got any questions.
Here is my project, please take a look
deck26
Scratcher
1000+ posts

I need help from you scratchers!

You're either gliding to the bottom of the screen before the forever loop or moving down until you touch the bottom in a loop so your code never gets chance to detect touching anything but the bottom colour.
Mikkerix
Scratcher
10 posts

I need help from you scratchers!

deck26 wrote:

You're either gliding to the bottom of the screen before the forever loop or moving down until you touch the bottom in a loop so your code never gets chance to detect touching anything but the bottom colour.
Okay, to what do I change my code?
deck26
Scratcher
1000+ posts

I need help from you scratchers!

Mikkerix wrote:

deck26 wrote:

You're either gliding to the bottom of the screen before the forever loop or moving down until you touch the bottom in a loop so your code never gets chance to detect touching anything but the bottom colour.
Okay, to what do I change my code?
After you detect a touch, why do you want to move to the bottom in a loop? Your code is stuck in a loop then so goes past the other colours to the bottom before coming out the loop and checking for touching a colour again. So it should be obvious what you need to change.

Why do you glide to the bottom before even checking for touching in the forever loop? That means the first touch can also only be detected at the bottom of the screen.

So what you should be doing is moving down the screen one bit at a time in the forever loop and after each move checking for any of your touching conditions before returning to the top of the forever loop and moving again. If you do detect a touch you move to the top of the screen but that's all you do.
Mikkerix
Scratcher
10 posts

I need help from you scratchers!

Okay, so what you're saying is that i need to move a bit, then check for the colors and then move again? That's gonna take alloooot of coding!

Last edited by Mikkerix (Dec. 7, 2017 16:00:39)

deck26
Scratcher
1000+ posts

I need help from you scratchers!

Mikkerix wrote:

Okay, so what you're saying is that i need to move a bit, then check for the colors and then move again? That's gonna take alloooot of coding!
Less than you currently have! have you added a repeat loop at the top of the forever or did I miss it before?

What you have roughly, and without checkiing is

forever
go to bottom of screen
if <<touching color [#f2a628] ?> and <>> then // repeat this code for each colour but you're always at the bottom when you check colours!
do something
go to bottom of screen
end
end
So for every combination of colour testing and costume you have a loop to take you to the bottom of the screen plus an extra loop doing that! Take all those loops out. What you should have is
forever
if <(y) < [-170]> then // plug in your own value
set [y v] to [150] // ditto
else
change [y v] by [10]
end
if <<touching color [#f2a628] ?> and <>> then // repeat this code for each colour
do something
end
end
The if block at the top of the forever then handles ALL the movement.

So for the 16 checks (costume/colour combination) you're doing you're taking out at least a goto x,y and a repeat loop where you change y by 10. That's 48 blocks removed plus the loop at the top makes 50 (and the glide before the loop!) and my replacement is a single set of 3 or 4 blocks.

You could greatly reduce the rest by having a list of responses and choosing either a random sentence from the list or having a way of selecting the appropriate one - eg for the top colour use the item that matches the costume#, for the next colour add 4 to the costume' and so on. Then you don't need to check the costume number when detecting a touch/arrow key.

Last edited by deck26 (Dec. 7, 2017 16:22:40)

Mikkerix
Scratcher
10 posts

I need help from you scratchers!

Okay i feel like we're misunderstanding each other, or i might be stupid. The point of my game is to get points the faster you click. I understood your point with the y's but i dont know how to make a list of responses (?). This might be because i have it on another language. I dont know what to do, is it to much to ask that you remix my project and show me what you ment with the arrows? Or you can try to re-explain. I feel stupid tbh
get3918
Scratcher
74 posts

I need help from you scratchers!

Mikkerix wrote:

Okay i feel like we're misunderstanding each other, or i might be stupid. The point of my game is to get points the faster you click. I understood your point with the y's but i dont know how to make a list of responses (?). This might be because i have it on another language. I dont know what to do, is it to much to ask that you remix my project and show me what you ment with the arrows? Or you can try to re-explain. I feel stupid tbh
hello there you might want to remix my project called scratch cat dacing on the rock

daniel wang
deck26
Scratcher
1000+ posts

I need help from you scratchers!

Mikkerix wrote:

Okay i feel like we're misunderstanding each other, or i might be stupid. The point of my game is to get points the faster you click. I understood your point with the y's but i dont know how to make a list of responses (?). This might be because i have it on another language. I dont know what to do, is it to much to ask that you remix my project and show me what you ment with the arrows? Or you can try to re-explain. I feel stupid tbh
No time right now but my version allows multiple clicks and yours doesn't as your sprites spend most of the time moving down the screen rather than testing for key presses!

The list of responses is less important; it would just save so much repeated code.
Uniquename1
Scratcher
100+ posts

I need help from you scratchers!

this is one of those situations where i just want to redo it and start over from scratch. This is what i have. I'm sure it could be more efficient but since much of the code is repeated for each different costume i just copied the code and changed costume number. I based it on the arrows position on screen instead of color as it could be touching 2 colors at once overlapping. I felt yours moved too fast too so I slowed it down. Just have to make sure they don't spawn so fast that there are two arrows in the hit area at the same time as how would it know which arrow you're pressing.

it moves down 5 and each time (now speeds up) checks first if it's in the hit area then checks the costume number and that it is the right arrow pressed and then checks where in the point zone it is. Now that i think it does nothing/ doesn't care if the wrong arrow is pressed nor if you hit it when outside the hit area (now fixed to include). those are just ignored. I suppose a simple if not the proper arrow when within the zone then it can subtract a point and disappear but would have to be if one of the wrong choices pressed then subtract point subtle difference. i may adjust that and decorate mine now.

Here's my example:

https://scratch.mit.edu/projects/191779375/#player

Last edited by Uniquename1 (Dec. 7, 2017 19:16:46)


Try my games.
Scratch Sprite Club VI Soccer
Star Fighter Shooting
Space Marines: Boarding Party Strategy
Lion Runner Running/ Platformer

Powered by DjangoBB

Standard | Mobile