Discuss Scratch

Leonkghunt
Scratcher
87 posts

How Can I Remove Decimals From My Game

Im Trying To Make A Unique Clicker Game. But There Are Some Ways To Get Decimals In Your Coin Count
https://scratch.mit.edu/projects/646088300/
Ways To Get Decimals:
Buying Equips
Attacking Afk Chest

I Don't Want Decimals, As They Can Become Visually Unappealing
61246.51532657884
instead of just
61246 or 61247

I Have Made A Decimal Detector In The “Coins” Sprite (It Can Detect If It's e+ Or Something Like 61246.51532657884) . But Im Not Sure How To Make It So It Does Not Turn 61246.51532657884 Into 6124651532657884.


when green flag clicked
forever
if <<[You] = [Like Platformers]> or <[You] = [Like Clickers]>> then
Check Out My Profile
end
end
bcs320jn
Scratcher
100+ posts

How Can I Remove Decimals From My Game

Have you tried using the
(round ())
block?

Triton2009
Scratcher
24 posts

How Can I Remove Decimals From My Game

([floor v] of (wanted variable))


This will remove every decimal in sight, without having to round the number to the nearest whole number.

Last edited by Triton2009 (March 15, 2022 23:56:41)


when [timer v] > [-1]
forever
if <everyone else is already taken :: sensing> then
be yourself :: custom
end
end
“Be yourself, everyone else is already taken”
- Oscar Wilde
Check this project out before the evil kumquats eat your siggy! Hurry!
Last edited by kaj Tomorrow 00:00:00
Triton2009
Scratcher
24 posts

How Can I Remove Decimals From My Game

Triton2009 wrote:

([floor v] of (wanted variable))


This will remove every decimal in sight, without having to round the number to the nearest whole number.

when [timer v] > [-1]
forever
if <everyone else is already taken :: sensing> then
be yourself :: custom
end
end
“Be yourself, everyone else is already taken”
- Oscar Wilde
Check this project out before the evil kumquats eat your siggy! Hurry!
Last edited by kaj Tomorrow 00:00:00
Sebastian_I_Guess
Scratcher
48 posts

How Can I Remove Decimals From My Game

Things that will work:

(round ())
([floor v] of ())
([ceiling v] of ())

——————————————————————————————-
Cheers!

((join((Sebastian_))((I_Guess))))
My hobbies are:
•Hi-Fidelity critical listening
•Coding
•Drawing (Cartoons)
iclass78
Scratcher
9 posts

How Can I Remove Decimals From My Game

([floor] of (X))
deck26
Scratcher
1000+ posts

How Can I Remove Decimals From My Game

But why are you getting decimals in the first place? Whatever you're changing coins by should always be a whole number.
bingula
Scratcher
100+ posts

How Can I Remove Decimals From My Game

deck26 wrote:

But why are you getting decimals in the first place? Whatever you're changing coins by should always be a whole number.
maybe it’s changing by a fractional number?

Watch out for the Gummy Bear album in stores on November 13th, with lots of music, videos, and extras. Watch out for the Gummy Bear album in stores on November 13th, with lots of music, videos, and extras. Watch out for the Gummy Bear album in stores on November 13th, with lots of music, videos, and extras. Watch out for the Gummy Bear album in stores on November 13th, with lots of music, videos, and extras. Watch out for the Gummy Bear album in stores on November 13th, with lots of music, videos, and extras. Watch out for the Gummy Bear album in stores on November 13th, with lots of music, videos, and extras. Watch out for the Gummy Bear album in stores on November 13th, with lots of music, videos, and extras. Watch out for the Gummy Bear album in stores on November 13th, with lots of music, videos, and extras. Watch out for the Gummy Bear album in stores on November 13th, with lots of music, videos, and extras. Watch out for the Gummy Bear album in stores on November 13th, with lots of music, videos, and extras. Watch out for the Gummy Bear album in stores on November 13th, with lots of music, videos, and extras. Watch out for the Gummy Bear album in stores on November 13th, with lots of music, videos, and extras. Watch out for the Gummy Bear album in stores on November 13th, with lots of music, videos, and extras. Watch out for the Gummy Bear album in stores on November 13th, with lots of music, videos, and extras. Watch out for the Gummy Bear album in stores on November 13th, with lots of music, videos, and extras. Watch out for the Gummy Bear album in stores on November 13th, with lots of music, videos, and extras. Watch out for the Gummy Bear album in stores on November 13th, with lots of music, videos, and extras. Watch out for the Gummy Bear album in stores on November 13th, with lots of music, videos, and extras. Watch out for the Gummy Bear album in stores on November 13th, with lots of music, videos, and extras.
CoconutGator
Scratcher
1000+ posts

How Can I Remove Decimals From My Game

deck26 wrote:

But why are you getting decimals in the first place? Whatever you're changing coins by should always be a whole number.
I assume prices of upgrades or coins gained scales over time.

Guess I should use the signature for explaining myself rather than Skyrim quotes. So hi. I'm Gator.

Metal albums I like:
* From Mars to Sirius - Gojira
* Citadel - Ne Obliviscaris
* With All Their Might - Dyscarnate
* Ghost Reveries - Opeth
* Monarchy - Rivers of Nihil

Recommend me more (please)
deck26
Scratcher
1000+ posts

How Can I Remove Decimals From My Game

CoconutGator wrote:

deck26 wrote:

But why are you getting decimals in the first place? Whatever you're changing coins by should always be a whole number.
I assume prices of upgrades or coins gained scales over time.
Should still only use whole numbers though.
-Qlec-
Scratcher
100+ posts

How Can I Remove Decimals From My Game

deck26 wrote:

But why are you getting decimals in the first place? Whatever you're changing coins by should always be a whole number.
Likely because some source (for example) has 8 coins, and an upgrade increases amount from that source by 10%, leading to 8.8 coins.

scratch fact of the day whenever i feel like changing it: Oddly enough, the (item ( ) of list) and (item # of ( ) in list) blocks can be placed where boolean blocks are supposed to go. This calls on the Boolean() function in JavaScript (the language Scratch is coded in), or whatever other boolean coercion method exists. Numbers and booleans behave as expected, with 0 (but, incorrectly, not -0), “” (empty string), and “false” (the string) converting to false. Everything else converts to true, so stuff like NaN seem to be interpreted as strings.
set [foo v] to [something]
forever {
set [foo v] to (join (foo)(foo))
} :: control
Select this, then press Shift + Down











// just your typical code
green is {
an ({apple :: hat #8fd97e}@addInput::ring #55993a) :: #7bc24f cap
}some text<>{
if not (☁ score :: pen) {
{rainbow [#de0909][#ffaa0d][#ffe70a][#7ccf00][#00cf79][#0072cf][#8d00cf] :: #7bc24f reporter}@addInput :: hat pen
}:: #6a8c32
} block [with v] ([text] :: #a8cc5a) ? :: #6a8c32
blablablahello
Scratcher
1000+ posts

How Can I Remove Decimals From My Game

-Qlec- wrote:

deck26 wrote:

But why are you getting decimals in the first place? Whatever you're changing coins by should always be a whole number.
Likely because some source (for example) has 8 coins, and an upgrade increases amount from that source by 10%, leading to 8.8 coins.
then they should instead round the upgrade cost, as it makes more sense then randomly losing 0.2 coins

Highlight, Hold shift, Press down arrow to scroll down


HEHEHEHAW

Everytime someone says “I did a quick search”, I question wether they meant they did a quicksearch (The algorithm) or a quick search (Quickly searching)

鸡你
实在是太美哦贝贝
实在是太美
多一眼就会爆炸
近一点会被融化
干嘛
你干嘛哈哈诶有
oh yea哈哈
多一眼就会爆炸
近一点会~融~化~~~

我个人认为,这个意大利面就应该拌四十二号混凝土,因为这个螺丝钉的长度,很容易会直接影响到挖掘机的扭矩,你知道吧,你往里砸的时候,一瞬间,他就会产生大量的高能蛋白,俗称UFO,会严重影响经济的发展,甚至对整个太平洋以及充电器,都会造成一定的核污染,你知道吧,啊,再者说根据勾股定理,你可以很容易的推断出,人工饲养的东条鹰鸡,它是可以捕获野生的三角函数的,所以说这个这个这个,你不管秦始皇的切面是否具有放射性,特朗普的n次方,是否含有沉淀物,都不应影响这个这个沃尔玛跟维尔康在南极汇合,啊!

大家好,我是练习两年半的个人练习生蔡徐坤!我喜欢唱,跳,rap,还有打篮球

早上好中国我喜欢吃冰淇凌!



















why are you down here why are you down here why are you down here




Leonkghunt
Scratcher
87 posts

How Can I Remove Decimals From My Game

There is a chest that grants x1.5 coins and is intended to be AFK farming. Also this game is no longer being updated.

when green flag clicked
forever
if <<[You] = [Like Platformers]> or <[You] = [Like Clickers]>> then
Check Out My Profile
end
end
iclass78
Scratcher
9 posts

How Can I Remove Decimals From My Game

if you want to remove the decimal from the number, you can do this:

if <(variable) > [0]> then 
set (variable) to ([floor] of (variable))

else

set (variable) to ([ceiling] of (variable))

end

how it will function like:

0.618 ⇒ 0
1.958 ⇒ 1
-1.694 ⇒ -1
-0.294 ⇒ 0

but if you want to get the decimal, you can do this:

set (variable) to ((variable) mod (1))

how it will function like:

69.421 ⇒ 0.421
-77.234 ⇒ 0.234
99.999 ⇒ 0.999
42.069 ⇒ 0.069

Last edited by iclass78 (May 11, 2024 13:32:03)

lukets98
Scratcher
25 posts

How Can I Remove Decimals From My Game

Hi, Ive seen peoples projects switch to a certain page or even have an outro on their projects when someone hits the stop button. How does that work?

See my favorite project here: ^_^
Woodfur
Scratcher
100+ posts

How Can I Remove Decimals From My Game

lukets98 wrote:

Hi, Ive seen peoples projects switch to a certain page or even have an outro on their projects when someone hits the stop button. How does that work?
https://en.scratch-wiki.info/wiki/Stop_Detection
In the future please start your own topic instead of necroposting.

say (something dumb)
switch costume to [dabbing v]
account_name_empty
Scratcher
10 posts

How Can I Remove Decimals From My Game

lukets98 wrote:

Hi, Ive seen peoples projects switch to a certain page or even have an outro on their projects when someone hits the stop button. How does that work?
this hides a sprite when the stop sign is pressed:

when green flag clicked
show
forever
reset timer
when [ timer] > (0.1)
hide
cosmosaura
Scratch Team
1000+ posts

How Can I Remove Decimals From My Game

This topic is closed to prevent necroposting.



___________________
Scratch Team Member
Love hiking, cycling and travelling.

Powered by DjangoBB