Discuss Scratch

Heacogra
Scratcher
100+ posts

Zoom In and Out Bug

So I have a game https://scratch.mit.edu/projects/BuildingSim/ and when you hit the zoom in and out button its supposed to set the size of all the houses/shops/buildings to 50% and if your zoomed out have them all 30% but I can't figure out how to do this. Thanks hopefully you can help me! Also (forgot to say) there is a bug where you can place a building on top of another building that I tried to do but for some reason it won't work something to do with the script in sprite 2 and 3.

Last edited by Heacogra (May 21, 2018 23:45:08)


data loading…
loading user data…
loading user data… succesful
loading image…
image loaded…

Please check out my new project. Here!.Looking for someone to make a good looking thumbnail others have delayed and not made it for over a month. So please be quick if you can make me one! Thanks -Heacogra
Heacogra
Scratcher
100+ posts

Zoom In and Out Bug

gor-dee wrote:

take out the
stamp
Then you can't place more than one house or store…

data loading…
loading user data…
loading user data… succesful
loading image…
image loaded…

Please check out my new project. Here!.Looking for someone to make a good looking thumbnail others have delayed and not made it for over a month. So please be quick if you can make me one! Thanks -Heacogra
gor-dee
Scratcher
1000+ posts

Zoom In and Out Bug

Then you either need to use
clear
and then redraw all the houses, which you could do if you save their co-ordinates in a list.
or
use clones…

In the house sprite, make a local variable “clone?” and put
set [clone? v] to [0]
in the first green flag script.

replace the second green flag with
when I start as a clone
show

and replace the stamp with
set [clone? v] to [1]
create clone of [myself v]
set [clone? v] to [0]
hide
Heacogra
Scratcher
100+ posts

Zoom In and Out Bug

In the clone script you suggested it just makes it even worse not letting you place houses anywhere or anything. And the stamp script and then clear and save coordinates I don't get…

data loading…
loading user data…
loading user data… succesful
loading image…
image loaded…

Please check out my new project. Here!.Looking for someone to make a good looking thumbnail others have delayed and not made it for over a month. So please be quick if you can make me one! Thanks -Heacogra
deck26
Scratcher
1000+ posts

Zoom In and Out Bug

If you use a grid system (you'll find a demo somewhere in my projects) all you need to do is record a number in a list which tells you what is at that grid position. Then very easy to redraw and to check whether the position is available. Both problems solved.

Edit - https://scratch.mit.edu/projects/47150778/

Zooming is then just a matter of costume sizes and adjusting the positions according to zoom level and, perhaps, the centre of zoom.

Last edited by deck26 (May 22, 2018 09:14:13)

gor-dee
Scratcher
1000+ posts

Zoom In and Out Bug

Heacogra wrote:

In the clone script you suggested it just makes it even worse not letting you place houses anywhere or anything. And the stamp script and then clear and save coordinates I don't get…
Sorry, I forgot one bit! You need the whole script under the “when i receive buildhouse” hat block to be inside
if <(clone?) = [0]> then

end
Heacogra
Scratcher
100+ posts

Zoom In and Out Bug

gor-dee wrote:

Heacogra wrote:

In the clone script you suggested it just makes it even worse not letting you place houses anywhere or anything. And the stamp script and then clear and save coordinates I don't get…
Sorry, I forgot one bit! You need the whole script under the “when i receive buildhouse” hat block to be inside
if <(clone?) = [0]> then

end
It still won't work for me???

data loading…
loading user data…
loading user data… succesful
loading image…
image loaded…

Please check out my new project. Here!.Looking for someone to make a good looking thumbnail others have delayed and not made it for over a month. So please be quick if you can make me one! Thanks -Heacogra
gor-dee
Scratcher
1000+ posts

Zoom In and Out Bug

Heacogra wrote:

It still won't work for me???
just had a look at it, you've put it back to stamp but I can see the “clone?” variable you made is a global (for all sprites) and not a local (this sprite only) which is important!
Heacogra
Scratcher
100+ posts

Zoom In and Out Bug

gor-dee wrote:

Heacogra wrote:

It still won't work for me???
just had a look at it, you've put it back to stamp but I can see the “clone?” variable you made is a global (for all sprites) and not a local (this sprite only) which is important!
I tried it again with local and it didn't work. I kept the script outside of the scripts I have so you can see what I did instead of stamp.

data loading…
loading user data…
loading user data… succesful
loading image…
image loaded…

Please check out my new project. Here!.Looking for someone to make a good looking thumbnail others have delayed and not made it for over a month. So please be quick if you can make me one! Thanks -Heacogra

Powered by DjangoBB