stopping actuators

Hey, I’m trying to figure out how to stop an actuator. That’s something I need to know.

However the need to know that came from two unrelated questions I have

  • I am using python raster cursor on the menu but I want it to disappear when I switch scenes to the game level. Right now it stays on screen while you are playing.
  • I want a small piece of intro sound to start after you leave the menu and start playing, but If I activate it from the menu it doesn’t play when the scene switches to the level.

More if someone can point to a good tutorial on states and the use of logic blocks that would be super helpful. I’ve been to tutorialsforblender3d but most of the information there is incomplete, and or lacking descriptions on how to use things.

I need to be able to select the space fighter you want to play in the menu and then have that be your hud when you play.

I know this is a lot of questions but maybe if one question gets answered it can lead to figuring out more…

  1. To turn of the mouse cursor you need only to write
    import Rasterizer
    Rasterizer.showMouse(0)
  2. I don’t know it exactly, but i think it is not possible. When you change the scene all data will be erased and the new scene are loaded. But you can use an external pyton sound file like pysound (mp3) or pySonic (mod) to load the sound file. Then the sound wouldn’t be stopt.

I think tutorialsforblender3d is one of the best. But here are a god video tutorial
http://www.blendercookie.com/category/all/tutorials/game-engine/.

HG1

Use the sound on a run-once sensor, then on the actuator play stop will mean the sound playes at the beginning of the scene, but goes quiet when it ends.

@sdfgsdfg

Thnks simple but effective. I should have figured that one out.

@HG1

The problem I am having is that the mouse cursor carries over to the next scene when I don’t want it to. I only want a cursor for the menus and nothing else, but it carries over anyway.

I made for you a simple custom menu blend file, with a menu (scene) and a game scene (scene.001). I hope that helps you.

Attachments

CustomDisplay2.blend (804 KB)

Try using pygame (www.pygame.org). You can save the sound into a GameLogic value and control it wherever you want. I’ve used it successfully and accidently had the problem of sounds continuing to play as scenes change.

Once you’ve installed it on your computer, pop this code into your game:

This bit needs to be in the startup script and only run once:


import pygame.mixer
pygame.mixer.init()

And this bit is for playing a sound:


import pygame.mixeer
GameLogic.playing_sound = pygame.mixer.Sound("test_sound.ogg")
GameLogic.playing_sound.play(0,0)

To stop the sound, you can ether just wait for it to finish playing, or run this code:


import pygame.mixer
GameLogic.playing_sound.stop()

Pygame is a whole suite of game development tools but the sound part is the only really useful part for Blender users.