Sound interaction between two sprites in MIT Scratch - audio

I am trying to create a DJing program in which one song starts when a sprite is clicked and another song starts (and the first one stops) when a second sprite is clicked. My solution has been to create a variable and use it as an on/off boolean, however the first song continues when the second song is activated. The code for the other sprite is the same with the variables changed.

I misstated the question: I'd actually like to keep one song playing (even if the other song is activated) until the related sprite (button) is clicked again. But using the suggestion of 'set volume to 0%' I was able to create this solution:

In fact you need no boolean. For first sprite the code is
When sprite clicked
stop all sounds
start sound (whatever sound you have)
For other sprite you do the same thing

Related

scratch sprite mosaic effect not working consistently

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

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. :)

How to load textures from a spritesheet in Godot 3

I've just got started with Godot yesterday, and I'm starting a game. I drew a few spritesheets for it. It seems much more efficient to pack all of the frames of an animation into a single image file, right?
Anyway, in Godot I have an AnimatedSprite, who of course has a SpriteFrames property, or whatever it's called. I want to split my spritesheet up into multiple images so that I can use each image as a separate frame in the animation, but as far as I can see Godot provides no such feature. Is this the case?
I've been searching for an answer on the web for a while now, and I can't find anything relevant.
I'd be very surprised if I can't do this in Godot, since I can do it in just about every other game engine I've seen.
Thanks!
(Just to clarify, I want to (programmatically or otherwise,) split a spritesheet into multiple textures, within Godot.)
Click New SpriteFrames in the Frames property menu of the AnimatedSprite node. Now click on the just created SpriteFrames next to the name of the Frames property. Animation Frames window should appear.
Click this Add frames from a Sprite Sheet button. Select your spite sheet file, set grid sizes and finally select individual frames from that sprite sheet.
(This works for me in Godot v3.2.2)
As it says: "Sprite node that can use multiple textures for animation."
Source: http://docs.godotengine.org/en/3.0/classes/class_animatedsprite.html
What you are searching for is using normal Sprite(2D), and set regions for it if you are using AnimationPlayer at each frame.
Example: https://www.youtube.com/watch?v=IGHcscKpA7Y
If you want to do all programmically, you just have to set the sprite to Sprite(2D), and then:
func _ready():
set_region(true)
set_region_rect(Rect2(positionx,positiony,width,height))
but i guess using AnimationPlayer is better option.
This is not tested because i should be sleeping right now, but it should work.

Can I create a video controller/ overlay in LiveCode

I have been using LiveCode for a couple of weeks now and have a question.
I would like to create a custom video controller with play, stop, rewind etc with LiveCode that shows and hides at the bottom of the screen if you touch the video currently playing in the video player on a mobile device.
I have created the menu page with a selection of 4 videos to choose from and selecting any video goes to the next card and plays the video. On completing the video it goes to the previous card allowing the next selection. The video controls on the Quicktime player with LiveCode are rather crude and I would like to create a better looking interface. Is this possible with LiveCode?
Yes it is possible.
Look at the following commands and functions in the dictionary:
start command
stop command
playStopped message
currentTime property
currentTimeChanged property
playLoudness property
In addition, make sure to look at what's in each entries "see also" list.

flash sound malfunction

Problem summary:
A sound (stream) placed inside a movie clip that is within another movie clip will start playing continuously when I use the play control to jump around on the main timeline.
Details:
I am using Flash CS3 but the same issue occurs with CS6. I've spent quite a bit time to search/research for the issue but didn't find a solution. To demonstrate the problem, I've reduced the flash movie to a very simple structure.
One the main timeline:
The first frame has a movie clip (Game MC) and a stop action.
Following the first frame, there are several frames, mostly empty except some text.
The last frame has a stop action.
On the Game MC timeline:
There is only one frame. On that frame, there is a movie clip (Card MC), and the stop action.
On the Card MC timeline:
It starts with 3 blank frames and a stop action.
Starting at frame 4, a sound (.wav format) is placed and is set to be "stream."
At the end of this timeline, there is a stop action.
From Flash CS3, I press Ctrl+Enter to test the movie. The movie stops on frame 1 of the main timeline with the card showing, no sound, as expected. Now I use "." to move the play head forward one frame at a time. No problem. I see the frames after the first frame. Still no sound, as expected. So far so good.
The problem starts when I use "," to move the play head backward, the sound in the Card MC starts to play, regardless where the play head is, even when the Game MC (thence the Card MC) is not on the stage. Worse, each press of "," will trigger another start of the same sound overlapping with the previous one. And the sound would continue in loops until I close the swf.
However, the problem will not occur if I place the Card MC directly on the main timeline. It only occurs when it is inside another movie clip (Game MC).
I need to solve this problem because the full version of the flash card game is to be placed in an HTML page with a javascript based play control, which allows the viewer to jump around in the swf timeline.
The fla file is at: https://docs.google.com/file/d/0B_5mgotjr4l5RDZaOGxFeFFWN1U/edit?pli=1
Any insight will be greatly appreciated.
Keith
This turns out to be a bug in Flash indeed and was told that it would not be in the next version of Flash. The workaround is to use the Sound class to load and play the sound.

Resources