Discuss Scratch

2Flashbacks
Scratcher
80 posts

I'm not great with clones and stuff

But I want my game to be able to make clones of the player character, but then the game ends if the player touches a clone. My current script has it so that 10 clones spawn over 25 seconds, then for another 25 seconds it checks to make sure the player isn't touching any clones, however when the clones spawn they change into a hitbox to find a place to spawn and when theres too many of them they think that the other spawned enemies are the player and keeps trying to spawn, often times going back to the player instantly ending the game, and more problems that I can't explain, so if you could help me try and fix this

I'm bad at writing something multiple times without reading what I wrote so there are probably parts I could have phrased better.

Also the scripts are in the top left of the studio

Last edited by 2Flashbacks (May 10, 2021 19:12:53)


when [POST] key pressed
wait until <Posted>
say (☁ Message)
stamp
wait until <Stamped>
add (☁ response) to (Discussions)
broadcast [Signature Here]
here is some stuff I am working on
Light systems testing
In the dark 3D (with a terrible jump script)
ISIS
in the dark is still in early stages since im messing with light scripts, to see what works well, and what doesnt lag the game, which is what my current light system testing project is for
Timothy01234567
Scratcher
91 posts

I'm not great with clones and stuff

You are lucky I am very experienced in cloning stuff. If you could send me the code It would be really helpful and I might fix it

The Ant Shop Fast, Quality and Beautiful
SansStudios
Scratcher
1000+ posts

I'm not great with clones and stuff

If you are referring to the game, Sketching Adventures, the issue is actually with the hide block. The hide block makes it impossible for you to ever be touching any other sprite. Since your script is set up like this:

when I start as a clone
hide
repeat until <not <touching [self v] ?>>
...
end

the sprite will never actually be able to sense it's touching anything. Instead, try using ghost:

when I start as a clone
show
set [ghost v] effect to [100]
repeat until <not <touching [self v] ?>>
...
end
set [ghost v] effect to [0]

Last edited by SansStudios (May 11, 2021 03:58:05)


scratchcloud
Click above to check it out! I've worked on it for over a year!























Just like sudden sadness comes hangin' on the breeze
2Flashbacks
Scratcher
80 posts

I'm not great with clones and stuff

SansStudios wrote:

the sprite will never actually be able to sense it's touching anything. Instead, try using ghost:

when I start as a clone
show
set [ghost v] effect to [100]
repeat until <not <touching [self v] ?>>
...
end
set [ghost v] effect to [0]
Thanks, this has helped, but I still need to figure out my game over script so it takes a long enough time for the enemy to find a spot before a game over, and make it so it can spawn on other clones… Oh well, other than that, thanks for helping with my problem

when [POST] key pressed
wait until <Posted>
say (☁ Message)
stamp
wait until <Stamped>
add (☁ response) to (Discussions)
broadcast [Signature Here]
here is some stuff I am working on
Light systems testing
In the dark 3D (with a terrible jump script)
ISIS
in the dark is still in early stages since im messing with light scripts, to see what works well, and what doesnt lag the game, which is what my current light system testing project is for
2Flashbacks
Scratcher
80 posts

I'm not great with clones and stuff

Also, real quick, how would you make it so each player has a seperate score instead of everyones score being put together?
(EX: Two players at the moment could share 1000 total kills, but by playing, if each gets 500 kills, it would go up to 2000 instead of 1,500 for each of them)

when [POST] key pressed
wait until <Posted>
say (☁ Message)
stamp
wait until <Stamped>
add (☁ response) to (Discussions)
broadcast [Signature Here]
here is some stuff I am working on
Light systems testing
In the dark 3D (with a terrible jump script)
ISIS
in the dark is still in early stages since im messing with light scripts, to see what works well, and what doesnt lag the game, which is what my current light system testing project is for
SansStudios
Scratcher
1000+ posts

I'm not great with clones and stuff

2Flashbacks wrote:

Also, real quick, how would you make it so each player has a seperate score instead of everyones score being put together?
(EX: Two players at the moment could share 1000 total kills, but by playing, if each gets 500 kills, it would go up to 2000 instead of 1,500 for each of them)

You would just have to use non-cloud variables, which I think you do in your “current game kills” variable.

scratchcloud
Click above to check it out! I've worked on it for over a year!























Just like sudden sadness comes hangin' on the breeze
2Flashbacks
Scratcher
80 posts

I'm not great with clones and stuff

SansStudios wrote:

2Flashbacks wrote:

Also, real quick, how would you make it so each player has a seperate score instead of everyones score being put together?
(EX: Two players at the moment could share 1000 total kills, but by playing, if each gets 500 kills, it would go up to 2000 instead of 1,500 for each of them)

You would just have to use non-cloud variables, which I think you do in your “current game kills” variable.

Aight thanks, I just fixed that
But now I have a new problem…
Why is it that just now when I fixed that my walking animation broke again
Thats the reason I had to entirely restart my game a couple days ago
got any ideas for why thats happening? or is it just my browser bugging out

Edit: Never mind, I fixed it by adding the hitbox sprite to its script, only I can't put it into a screen refresh or else the script won't work so whenever you hit the side of a platform you can still see the hitbox

Last edited by 2Flashbacks (May 11, 2021 18:45:43)


when [POST] key pressed
wait until <Posted>
say (☁ Message)
stamp
wait until <Stamped>
add (☁ response) to (Discussions)
broadcast [Signature Here]
here is some stuff I am working on
Light systems testing
In the dark 3D (with a terrible jump script)
ISIS
in the dark is still in early stages since im messing with light scripts, to see what works well, and what doesnt lag the game, which is what my current light system testing project is for
Yusei-Fudo
Scratcher
1000+ posts

I'm not great with clones and stuff

Here are some ways clones will operate

when I start as a clone//This block makes it so that only clones can do the scripts under this block no matter which clone it is. However, you can change that to only certain clones can do certain Scripts under the clone block.

(A variable)//Not just any variable, it is a local variable (The kind of variable that you made as "For this sprite only". When a clone is created, another of that variable is "created". Not as in duplicate, but only that clone can access that variable. So even if the clone decides to change the variable, the actual variable stays the same. This concept is very often seen in Scrolling games.

when I receive [blocks v]// Clones also receive broadcasts. Often, you might see a script like the ones shown below. What it does is deletes all the clones. It's able to do that because like said, clones also receive broadcasts.
when I receive [a message v]
delete this clone

I'm a decent coder who has a huge passion for coding. I taught myself all the coding skills I have now. And with those skills, I have made some pretty decent projects, check them out! Be sure to ⭐ ❤️ & Follow, too! I have a few pictures below which are actually links. Click on them to take to different projects that I made. Might come in handy. :)

Need a project where you can check to see if you can use someone's camera or not? Here's one:


Need a project to detect when someone has clicked the stop sign? Take a look at this:

Need a project that can point at specific clones, etc? Why not use this:


Need to prank someone? Tell them to click this picture, but also make sure they're signed onto Scratch, otherwise, it doesn't work:


For more of my projects, just click on this picture:

Powered by DjangoBB