Re: Enemy update sound question for bgt.

2019-08-04 Thread AudioGames . net Forum — Developers room : redfox via Audiogames-reflector


  


Re: Enemy update sound question for bgt.

Thanks for the help, I will look at that.The funny thing is, I don't usually have trouble with this, this kind of stuff is kind of below me in ability, but for some reason I just couldn't think of a way to do it.Also, I couldn't find the function to play a sound with a specific slot, that was my problem.Thanks for the help...

URL: https://forum.audiogames.net/post/453258/#p453258




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Enemy update sound question for bgt.

2019-08-04 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Enemy update sound question for bgt.

Yeah. Fox, I also feel like you need to check out game programming in practice part 2 (Virus attack tutorial) because it also does a decent job of showing you how to actually use sound pool.

URL: https://forum.audiogames.net/post/453255/#p453255




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Enemy update sound question for bgt.

2019-08-04 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector


  


Re: Enemy update sound question for bgt.

The play methods in the sound_pool return an int, for the slot the sound is played in. Have the enemy remember that, as in post 6.

URL: https://forum.audiogames.net/post/453236/#p453236




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Enemy update sound question for bgt.

2019-08-04 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Enemy update sound question for bgt.

I am not sure what you mean. Consider this code//I haven't written bgt in a while and thus cannot guarantee error-free code
enemy@ enemies[];
class enemy
{
int x, y, sound;
enemy(x, y)
{
x = x;
y = y;
sound = p.play_3d("enemy.ogg", me.x, me.y, me.z, x, y, z, true);
}//cf
}//cc
//A sample enemy loop.
//Keep in mind that our enemy has a sound slot that they're holding onto for us to use later.
void enemyloop()
{
for (uint i = 0; i < enemies.length; i ++)
{
p.update_sound_3d(enemies[i].sound, enemies[i].x, enemies[i].y, enemies[i].z);
}//cl
}//cfI should also note that calling update_sound constantly is a bad idea, primarily because your enemy won't move each iteration of the loop. Personally, what I would do is create the enemy class and add a "can_move" method to it that checks if it can move and if so, moves them wherever they need to go. An example using that logic is belowenemy@ enemies[];
class enemy
{
int x, y, sound, movetime;
timer movetimer;
enemy(x, y, mvt)
{
x = x;
y = y;
movetime = mvt;
sound = p.play_3d("enemy.ogg", me.x, me.y, me.z, x, y, z, true);
}//cf
bool can_move()
{
if (movetimer.elapsed >= movetime) return true;
return false;
}//cf
}//cc
void enemyloop()
{
for (uint i = 0; i < enemies.length; i ++)
{
if (enemies[i].can_move() == true)
{
//moving logic goes here
p.update_sound_3d(enemies[i].sound, enemies[i].x, enemies[i].y, enemies[i].z);
}//ci
}//cl
}//cfThis should make your code faster overall when dealing with large groups of enemies on a map.

URL: https://forum.audiogames.net/post/453232/#p453232




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Enemy update sound question for bgt.

2019-08-04 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Enemy update sound question for bgt.

I am not sure what you mean. Consider this code//I haven't written bgt in a while and thus cannot guarantee error-free code
enemy@ enemies[];
class enemy
{
int x, y, sound;
enemy(x, y)
{
x = x;
y = y;
sound = p.play_3d("enemy.ogg", me.x, me.y, me.z, x, y, z, true);
}//cf
}//cc
//A sample enemy loop.
//Keep in mind that our enemy has a sound slot that they're holding onto for us to use later.
void enemyloop()
{
for (uint i = 0; i < enemies.length; i ++)
{
p.update_sound_3d(enemies[i].sound, enemies[i].x, enemies[i].y, enemies[i].z);
}//cl
}//cfI should also note that calling update_sound constantly is a bad idea, primarily because your enemy won't move each iteration of the loop. Personally, what I would do is create the enemy class and add a "can_move" method to it that checks if it can move and if so, moves them wherever they need to go. An example using that logic is belowenemy@ enemies[];
class enemy
{
int x, y, sound, movetime;
timer movetimer;
enemy(x, y, mvt)
{
x = x;
y = y;
movetime = mvt;
sound = p.play_3d("enemy.ogg", me.x, me.y, me.z, x, y, z, true);
}//cf
bool can_move()
{
if (movetimer.elapsed >= movetime) return true;
return false;
}//cf
}//cc
void enemyloop()
{
for (uint i = 0; i < enemies.length; i ++)
{
if (enemies[i].can_move() == true)
{
//moving logic goes here
p.update_sound_3d(enemies[i].sound, enemies[i].x, enemies[i].y, enemies[i].z);
}//ci
}//cl
}//cf

URL: https://forum.audiogames.net/post/453232/#p453232




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Enemy update sound question for bgt.

2019-08-04 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Enemy update sound question for bgt.

I am not sure what you mean. Consider this code//I haven't written bgt in a while and thus cannot guarantee error-free code
enemy@ enemies[];
class enemy
{
int x, y, sound;
enemy(x, y)
{
x = x;
y = y;
sound = p.play_3d("enemy.ogg", me.x, me.y, me.z, x, y, z, true);
}//cf
}//cc
//A sample enemy loop.
//Keep in mind that our enemy has a sound slot that they're holding onto for us to use later.
void enemyloop()
{
for (uint i = 0; i < enemies.length; i ++)
{
p.update_sound_3d(enemies[i].sound, enemies[i].x, enemies[i].y, enemies[i].z);
}//cl
}//cfI should also note that calling update_sound constantly is a bad idea, primarily because your enemy won't move each iteration of the loop. Personally, what I would do is create the enemy class and add a "can_move" method to it that checks if it can move and if so, moves them wherever they need to go. An example using that logic is belowenemy@ enemies[];
class enemy
{
int x, y, sound;
timer movetimer;
enemy(x, y, mvt)
{
x = x;
y = y;
movetime = mvt;
sound = p.play_3d("enemy.ogg", me.x, me.y, me.z, x, y, z, true);
}//cf
bool can_move()
{
if (movetimer.elapsed >= movetime) return true;
return false;
}//cf
}//cc
void enemyloop()
{
for (uint i = 0; i < enemies.length; i ++)
{
if (enemies[i].can_move() == true)
{
//moving logic goes here
p.update_sound_3d(enemies[i].sound, enemies[i].x, enemies[i].y, enemies[i].z);
}//ci
}//cl
}//cf

URL: https://forum.audiogames.net/post/453232/#p453232




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Enemy update sound question for bgt.

2019-08-04 Thread AudioGames . net Forum — Developers room : redfox via Audiogames-reflector


  


Re: Enemy update sound question for bgt.

ok, and how do you play a sound using a specific slot, by the name of  enemys[i].sound?

URL: https://forum.audiogames.net/post/453227/#p453227




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Enemy update sound question for bgt.

2019-08-04 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Enemy update sound question for bgt.

for (uint i = 0; i < enemys.length; i++)
{
p.update_sound_3d(enemys[i].sound, enemys[i].x, enemys[i].y, enemys[i].z);
}//cl
That is assuming that you have Sam's modified 3d sound pool, otherwise you will be forced to stick with 2d

URL: https://forum.audiogames.net/post/453224/#p453224




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Enemy update sound question for bgt.

2019-08-04 Thread AudioGames . net Forum — Developers room : redfox via Audiogames-reflector


  


Re: Enemy update sound question for bgt.

yes but how do I make it just update the p sound_pool position for that specific enemy.In the enemyloop function I have a for loop that goes through all the enemies and then does all the things, but how would I make it update for  enemys[i]? 

URL: https://forum.audiogames.net/post/453221/#p453221




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Enemy update sound question for bgt.

2019-08-03 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Enemy update sound question for bgt.

Update_sound_3d(x,y,z)

URL: https://forum.audiogames.net/post/453056/#p453056




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Enemy update sound question for bgt.

2019-08-03 Thread AudioGames . net Forum — Developers room : redfox via Audiogames-reflector


  


Enemy update sound question for bgt.

So I'm trying to make a simple enemy, just to see how it works, and for some reason, I can't quite figure out how to make it play a loop over it that moves with it.The enemy moves completely randomly, full 3d, so it moves forward, backward, left, and right, and 45 degrees maybe for higher level enemies. And I want them to play random loops for each enemy, but I don't know how to have the loops stay on the enemies. Please help?

URL: https://forum.audiogames.net/post/453045/#p453045




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector