Skip to content

Add glide (number) secs to [dropdown] block #662

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 28, 2017
Merged

Add glide (number) secs to [dropdown] block #662

merged 8 commits into from
Aug 28, 2017

Conversation

Kenny2github
Copy link
Contributor

@Kenny2github Kenny2github commented Aug 10, 2017

Resolves

scratchfoundation/scratch-gui#598

Proposed Changes

Adds the block to motion.js, basically copying target selection from go to and copying the glide from glide.

Comes with scratchfoundation/scratch-blocks#1046 and scratchfoundation/scratch-gui#634

@Kenny2github
Copy link
Contributor Author

@ericrosenbaum seeing as you were requested for review, any comments? /cc @thisandagain

@ericrosenbaum
Copy link
Contributor

ericrosenbaum commented Aug 16, 2017

We should consider refactoring to reduce duplication of the code (which could be a source of bugs later). So instead of copying and pasting the code from goto and glide, we should make two new helper functions, one for target selection and one for gliding, that can be called by the other blocks. What do you think?

@ericrosenbaum
Copy link
Contributor

Also note that to update the menu with the names of the sprites, we'll need to add a function in scratch-gui like this.

@Kenny2github
Copy link
Contributor Author

Ah, I see. Will change this tomorrow :D

@Kenny2github
Copy link
Contributor Author

@ericrosenbaum Note: I made glideTo just use the original glide for relatively obvious reasons.

@Kenny2github
Copy link
Contributor Author

Hmm, I knew something was wrong but for some reason I can’t see Travis logs. Will look into it when I can.

if (!goToTarget) return;
targetX = goToTarget.x;
targetY = goToTarget.y;
}
util.target.setXY(targetX, targetY);
return (targetX, targetY);

This comment was marked as abuse.

This comment was marked as abuse.

@Kenny2github
Copy link
Contributor Author

Hmm, I was wondering if that would be a problem. I don’t really know how JavaScript global/locals work though so a little help would be appreciated (assuming I don’t research it first).


goTo (args, util) {
let targetXY = getTarget(args.TO, util);
util.target.setXY(targetXY[0], targetXY[1]);

This comment was marked as abuse.

This comment was marked as abuse.

@Kenny2github
Copy link
Contributor Author

Ah, “getTarget” is not defined - I’ll really need some global/local help here.

}

goTo (args, util) {
const targetXY = getTarget(args.TO, util);

This comment was marked as abuse.

This comment was marked as abuse.

@Kenny2github
Copy link
Contributor Author

@towerofnix Finally, Travis is happy :)

Final question is, I guess:
Status on this PR?

@@ -51,24 +52,31 @@ class Scratch3MotionBlocks {
util.target.setXY(x, y);
}

goTo (args, util) {
getTarget (TO, util) {

This comment was marked as abuse.

This comment was marked as abuse.

Rename function getTarget to getTargetXY
Rename parameter TO to targetName
@Kenny2github
Copy link
Contributor Author

@rschamp Done! Travis is still happy so that's a plus :)

Merge when you will.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants