ScratchData LogoScratchData
Back to DanloTest's profile

Costume # Discrepancy

DADanloTest•Created May 20, 2015
Costume # Discrepancy
2
2
21 views
View on Scratch

Instructions

Click the green flag to run the script pictured. Then press space to generate random values of n. Read the notes and credits for more info.

Description

I was playing Crusade (https://scratch.mit.edu/projects/67967240/), a really fun game by @b00k_w0rm, when I noticed a glitch that allowed one of the stats to be over-upgraded. I looked at the scripts, and everything seemed fine... but then I started getting suspicious about the values reported by the "costume #" variable. This led me to discover an issue related to the small errors that occur when doing math with decimals. If I tell a sprite to switch to costume n, where n is slightly smaller than a round number, the costume will switch to that corresponding to the nearest integer, but the costume # that is reported will round DOWN to the nearest integer! This means you can end up with the costume number not matching the actual costume.

Project Details

Project ID63212492
CreatedMay 20, 2015
Last ModifiedJune 21, 2015
SharedJune 21, 2015
Visibilityvisible
CommentsAllowed