scratch sprite mosaic effect not working consistently - sprite

I have a simple shooter game where a gliding sprite is supposed to shatter (using mosaic effect) when hit, then disappear. Problem is, the sprite only shatters and disappears maybe 1 time out of 5. Here's the relevant code snippet:
For more context, here's the link:
https://scratch.mit.edu/projects/524150880

In the project, you're using set mosaic effect, not change mosaic effect. This makes it just do nothing and then hide.

I replied to your other question on this project
Maybe you have to increase the delay, if it is .25s it is just a quarter of a second and players may not be able to see it. Try extending it!
If that is not the reason then I don't know

Related

How can the following errors be resolve in SCRATCH?

I created a bouncing ball game in scratch for CS50 PSET0.
The game works well as I expected, except for the following bug/errors:
The game can be paused by pressing the UP Arrow key on the keyboard, even BEFORE it is started or AFTER the game is over. THIS SHOULD ONLY WORK WHEN A LEVEL HAS BEEN SELECTED AND GAME STARTED AND NOT BEFORE OR AFTER IT IS STARTED. [WORKING ON IT]
I set the Paddle dragmode to not draggable, yet it's not working as you can still drag the paddle using the mouse. [SOLVED]
Falling eggs/bomb won't stop falling when the game is over or paused. [TRYING TO SOLVE IT BROUGHT A NEW BUG] One egg appears at the bottom of the screen after I paused and resume the game. I'm not sure how to hide that one stubborn egg.
On hitting the paddle or edge, the ball bouncing isn't very smooth and natural. It sometimes lag. [WORKING ON IT]
JUST CURIOUS: Why is the code "when I receive Setting btn Clicked" not working on the sound and music button sprite? [SOLVED]
I will appreciate all your kind suggestions.
Here's my project
NB: if the question seems unclear and you tend to understand it. Kindly feel free to suggest an edit. Thanks.
For point 1, you could test with an if statement whether the game is currently running. (Using the same variable you use to pause the game.)
As for the dragging of the paddle, I can't seem to drag it. That is, I can't drag it when I am playing, but I can when in the editor. This is always the case, you can drag any sprite around while editing, but not when playing without the editor open. This is the default behaviour of sprites as well, you do not have to declare it each time. A reason for you to want to drag sprites is when you use the Pen Extension to create a drawing program.
To stop the eggs from falling, you could pause the clones the same way you pause the ball when moving.
To let the ball turn more smoothly you could let it turn between an angle from -90° to 90° opposite to the surface it hits. To implement this would be quite difficult with a single line. You could, if you don't mind it hitting the edge instead of the border you built, split it so you include the built-in block: if on edge, bounce. The if-statement would then only include the touching of the paddle (and maybe the danger bar). In this statement, you would select an angle between -90 and 90 degrees.
For 5, there must've gone something wrong when you wanted to design this, the when I receive [setting btn clicked v] block is just not connected. :)

Green square on game canvas using Phaser

Can someone please tell me why I'm getting a green square on my Phaser game canvas as below?
Without seeing any code I can tell you that you'll see that when an image can't be loaded by the Phaser framework.
Open developer tools in your browser of choice and refresh after opening the Network tab. You should see a 404 for one of your images.
I believe if you look at the standard browser console you may also see messages about the name of the asset that it failed to load.
I had a slightly different case. Images were being loaded in the init function, which apparently doesn't work. I renamed that function to preload and suddenly the green squares are gone and the images show up.
My case was also a little different too; it appeared that all my image resources were loaded, but I think I was trying to create the sprites a little too quickly - in order words, I was trying to create and add sprites to my scene before the scene was properly loaded.
I'm going to try waiting until 'scene.scene.isActive(key);' returns a boolean of true.....maybe that's what will solve my issue. Failing that, I might just put in some sort of sleep/await promise of 1 second or something (not ideal, but might work)
ALSO NOTE: Part of the reason I was able to create my sprites too quickly was because I was doing so in my own custom function, not the typical create() function. Actually, the best solution is probably to create my sprites in the create() function and not a custom function...

JavaFX request layout does nothing

I'm absolutely confused.
Studying JavaFX for several months.
In my application I have a custom scrollpane, where I recount scrollbar values manually. Everything is OK there. And when I resize the window it also works fine.
The problem appears when I launch application the first time. I see that my scrollbar value is incorrect, and it become correct when I resize window or move the pane placed inside scrollpane.
So theoretically all i need is just update my scrollpane on window start, or after window start. And... I've spent more than week trying to find out how. And the only way I've managed to do this is to call layoutChildren recursively. This is awful of course.
layout() - doesn't have any effect. I tried it with runLater() and placed it inside timer call. No way!
requestLayout() - also makes no sense.
Is it possible just UPDATE or REDRAW or MARK CONTROL TREE AS DIRTY in JAVAFX ???
Ok well, try this way
first gaining the focus, then try relayout options..
blah.requestFocus();
blah.layout();
Well. layout() works. But it shouldn't be placed inside Platform.runLater().
In simple example everything is fine. Then I suggest I have something wrong with my controls.
Thanks.

Trouble with the javafx 8 sample 3D application

Since the release of javafx 8 is coming up right around the corner, I figured now would be a good time to get better acquainted with a few of the new features. First on my list: enhanced (true) 3D shapes and rendering! Working for an engineering company, being able to integrate a rich 3d environment into some of our visualizations will be great!
In any case, I was working through the 'getting started' here and all was well. Able to compile everything, getting familiar with how they structure all of their layouts in 3d, etc. etc. It was great! After familiarizing myself with some of the more advanced translations, I decided to take a look at their final 'sample 3d application' that had things like mouse and keyboard listeners to set the angle and orientation of the camera, which was the only thing I hadn't done yet. (you can find a link to the source code I downloaded for it, complete with a nbproject here It's called MoleculeSampleApp.zip and it's in the top right corner of the page).
So I go to compile it, everything shows up just fine, the molecule, the axis, and then I try to initiate any action at all, a mouse click, drag, a recognized keyboard input, etc. Everything on the scene simply vanishes.
Well that's strange, I think to myself, so I take a look at the code. Everything looks to be in order, and a few print lines later, I find out that the contents of the graph aren't disappearing until the very END of the listener, whenever that happens to be. Nothing inside of the listener is actually causing the disappearing (unless of course it's the hide/show keyboard shortcuts).
To be honest, I'm a bit baffled by this. There are no exceptions being thrown, no errors printing out. It just disappears, and that's the end of it.
If anyone has any idea why this is happening I would be immensely grateful. It's worth noting, I'm using the javafx 8 developer preview b132.
(if you would like me to post the entire source here, let me know, it's only about 600 lines altogether, but that's pretty heavy for a SO question so I'm just going to leave the links for now).
tl;dr
The moleculesimpleapp.zip located here makes everything disappear on any action it knows to listen for, with no clear reason, why?
-Will

C# ListView Image/Icon margin/padding

Is it possible to reproduce what is on the picture below in ListView, padding/margin icon to the right.
http://img801.imageshack.us/img801/4043/listview.png
My first question here, so I couldnt post the picture here.
Basically I need to move the ListView icon more right, I am reproducing file/directory browser, so the fails that are in a directory need to be below them and slighty right like in the picture, I have everything else figured out.
You should be using a TreeView control:
http://msdn.microsoft.com/en-us/library/1dtsdfkx.aspx
But if you insist on hacking a ListView to render this way, you'll simply have to take over drawing each row yourself. You can do so using the OwnerDraw property, though be warned that there's a lot of corner cases here so you should do a lot of reading to see what people have had to deal with when implementing this:
http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.ownerdraw.aspx

Resources