Playing a sound help

Non-platform specific questions.

Playing a sound help

Postby PreludeDikter » Tue May 31, 2011 7:34 pm

Hi, i'm new to these forums. I was having trouble trying to figure out how to get a "Event" to shoot towards another event, like a bullet towards a sight.

I'd like the "sight" to follow the mouse, the bullet starts at the player, and when clicked, fires at the sight, GOES PAST IT, and off screen, or collide with so an so, or what ever.

I've managed to get the bullet to start at the player, and fire in specified directions, but i'm having trouble finding the sight's x and y, so the bullet will fire at it, and not stop where ever the sight was at that given time, and then hang there doing nothing.

Sorry if the explanation sucks.
Last edited by PreludeDikter on Thu Jun 02, 2011 3:14 am, edited 1 time in total.
PreludeDikter
 
Posts: 4
Joined: Fri May 27, 2011 3:59 am
Score: 0 Give a positive score

Re: Bullet direction help

Postby schnellboot » Tue May 31, 2011 7:49 pm

you need directional_velocity and angle
here are the script references
angle: Move the Actor's angle (0 to 360, from the positive x axis, counterclockwise, in degrees).

directional_velocity: The Actor's velocity in pixels / frame, in angle direction (set this Actor variable only when it is used with angle)


to set the angle to your mouse you can use this code
Code: Select all
angle = direction(xscreen, yscreen, xmouse, ymouse);


if you need any more help just ask me
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: Bullet direction help

Postby PreludeDikter » Tue May 31, 2011 10:53 pm

Would you be able to upload a small demo? I'm able to understand coding so much easier when i see it in the editor.
I'm not sure what you mean by your post.
PreludeDikter
 
Posts: 4
Joined: Fri May 27, 2011 3:59 am
Score: 0 Give a positive score

Re: Bullet direction help

Postby skydereign » Tue May 31, 2011 11:09 pm

Here is an example using the code schnellboot provided. The code goes into the Create Actor event of the bullet.
Attachments
bullet.ged
(1.33 KiB) Downloaded 69 times
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Bullet direction help

Postby PreludeDikter » Thu Jun 02, 2011 3:13 am

Thanks alot, that's exactly what i needed. Sorry if i sounded like a jerk... :?

I have another problem i'd like to present to you guys, I've been having trouble playing sounds and music. It keeps saying,
"File is not supported, please change to PCM encoded .WAV file"...

first i don't know what it means, and when i downloaded another game from this site, it started working (for all the games, i could upload music and sounds to previous games, and they all did what they were supposed too.), but after awhile it started up again, so anything that was already uploaded wouldn't play in-game, and it brought up that error message when i tried to re upload.


I'm also using ubuntu(linux) if that has anything to do with it.

any ideas? :|
PreludeDikter
 
Posts: 4
Joined: Fri May 27, 2011 3:59 am
Score: 0 Give a positive score

Re: Playing a sound help

Postby skydereign » Thu Jun 02, 2011 6:54 am

I encountered this before (back when sound was by default working for Linux). The problem it is having I don't believe are actually related to the pcm encoding, as I tried to re-encode it in audacity, but it still didn't work. Fedora stopped supporting legacy sound, so I stopped running into the problem. So, not really sure if there is a fix, if anyone else has experienced this do tell. Just for experimenting, can you upload one of the files that would give the error? Also, are you using the gameEditorLinuxAlsa file provided on the game-editor.net site? Or does Ubuntu still support oss?
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Playing a sound help

Postby PreludeDikter » Thu Jun 02, 2011 8:33 pm

And now it's working again. It doesn't matter what file it was working or not working on, because it would either work on all of them, or not work on all of them. I guess all i can do is finish my game, and wait till when it's working to export it. XD
PreludeDikter
 
Posts: 4
Joined: Fri May 27, 2011 3:59 am
Score: 0 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest