Discuss Scratch

pineapplechan855
New Scratcher
42 posts

Laser clone not deleting itself after touching asteroid clone.

Hey,
I'm making a space game and laser clone coming from space ship sprite is not deleting itself even after touching the asteroid clone. I have added the block to delete the sprite but nothing is happening, and I notice the code to set the size is also not working.
Could anyone of you take a look?

Thanks.
Link- https://scratch.mit.edu/projects/905259251/editor
CallMeAnt-_-
Scratcher
38 posts

Laser clone not deleting itself after touching asteroid clone.

Do you mind if i remix to fix it and you can just change game accordingly?
pineapplechan855
New Scratcher
42 posts

Laser clone not deleting itself after touching asteroid clone.

I didn't get you. What do you mean by remix?
CallMeAnt-_-
Scratcher
38 posts

Laser clone not deleting itself after touching asteroid clone.

Are you new to scratch?!?
_turtle64
Scratcher
100+ posts

Laser clone not deleting itself after touching asteroid clone.

CallMeAnt-_- wrote:

Are you new to scratch?!?
Well, it quite literally says “New to scratch” under their username.

pineapplechan855 wrote:

I didn't get you. What do you mean by remix?
You can remix a project by clicking the “Remix” button on the project page. When you remix a project, you make a copy of it which you can change and save and make it your own. CallMeAnt basically wants to remix your project so he can put the proper scripts, and then you can copy those scripts from his remix.
Jlerpy
Scratcher
1000+ posts

Laser clone not deleting itself after touching asteroid clone.

The set size isn't working because costumes have a minimum size. If you try changing size on the main sprite to 20, you can see it only goes down to 63. You may need to redraw the costume smaller.
pineapplechan855
New Scratcher
42 posts

Laser clone not deleting itself after touching asteroid clone.


CallMeAnt-_- wrote:

Do you mind if i remix to fix it and you can just change game accordingly?
Thanks for looking into it. I don't mind if you remix it in scratch. I liked what you did with the space ship, could you explain to me what was your though process with it. I didn't understand 1*left arrow key - right arrow key. What does it mean?
Thanks.
Jlerpy
Scratcher
1000+ posts

Laser clone not deleting itself after touching asteroid clone.

pineapplechan855 wrote:

I didn't understand 1*left arrow key - right arrow key. What does it mean?
Thanks.


It's a way of putting left and right into the same block. Pushing the left button sets left to 1, pushing the right button sets right to 1, pushing both cancels out to 0.
pineapplechan855
New Scratcher
42 posts

Laser clone not deleting itself after touching asteroid clone.

Jlerpy wrote:

pineapplechan855 wrote:

I didn't understand 1*left arrow key - right arrow key. What does it mean?
Thanks.


It's a way of putting left and right into the same block. Pushing the left button sets left to 1, pushing the right button sets right to 1, pushing both cancels out to 0.
Thanks for that. But how did he get that 0.9? Trial and Error? or a math wiz? I tried 1 and it is gliding super fast. Any tips to improve my coding to this level except practice which is required.
Jlerpy
Scratcher
1000+ posts

Laser clone not deleting itself after touching asteroid clone.

pineapplechan855 wrote:

Jlerpy wrote:

pineapplechan855 wrote:

I didn't understand 1*left arrow key - right arrow key. What does it mean?
Thanks.


It's a way of putting left and right into the same block. Pushing the left button sets left to 1, pushing the right button sets right to 1, pushing both cancels out to 0.
Thanks for that. But how did he get that 0.9? Trial and Error? or a math wiz? I tried 1 and it is gliding super fast. Any tips to improve my coding to this level except practice which is required.

That *0.9 means that each frame, it reduces its horizontal velocity (whether left or right) by ten percent. So it gradually slows down, and eventually stops.

It's no surprise that *1 feels super-fast, as that's making it effectively frictionless.

It's worth experimenting with different multipliers to find how they feel.
pineapplechan855
New Scratcher
42 posts

Laser clone not deleting itself after touching asteroid clone.

Jlerpy wrote:

pineapplechan855 wrote:

Jlerpy wrote:

pineapplechan855 wrote:

I didn't understand 1*left arrow key - right arrow key. What does it mean?
Thanks.


It's a way of putting left and right into the same block. Pushing the left button sets left to 1, pushing the right button sets right to 1, pushing both cancels out to 0.
Thanks for that. But how did he get that 0.9? Trial and Error? or a math wiz? I tried 1 and it is gliding super fast. Any tips to improve my coding to this level except practice which is required.

That *0.9 means that each frame, it reduces its horizontal velocity (whether left or right) by ten percent. So it gradually slows down, and eventually stops.

It's no surprise that *1 feels super-fast, as that's making it effectively frictionless.

It's worth experimenting with different multipliers to find how they feel.
Thank you everyone for the tips.
pineapplechan855
New Scratcher
42 posts

Laser clone not deleting itself after touching asteroid clone.

CallMeAnt-_- wrote:

Do you mind if i remix to fix it and you can just change game accordingly?

pineapplechan855 wrote:

Jlerpy wrote:

pineapplechan855 wrote:

I didn't understand 1*left arrow key - right arrow key. What does it mean?
Thanks.


It's a way of putting left and right into the same block. Pushing the left button sets left to 1, pushing the right button sets right to 1, pushing both cancels out to 0.
Thanks for that. But how did he get that 0.9? Trial and Error? or a math wiz? I tried 1 and it is gliding super fast. Any tips to improve my coding to this level except practice which is required.

Hey can you tell me how to write this code so that the space ship glides when left arrow and right arrow key is pressed. I tried looking into your remix but apparently you deleted that. I tried to recreate it on my own but is slow. Here's what I tried:
when I receive [game_start v]
set [xv v] to ((1) * (<key [ right arrow] pressed?> - <key [ left arrow] pressed?>))
change [xv v] by ((xv) * (0.9))
change x by (xv)
Jlerpy
Scratcher
1000+ posts

Laser clone not deleting itself after touching asteroid clone.

I'd suggest Change By instead of Set, otherwise -1/+1 is the most you'll get. And remember to put these blocks in a loop, otherwise it will only check one time, then stop.

Powered by DjangoBB