Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - VegeTato

#1
Quote from: Snarky on Wed 12/04/2017 17:45:13
If what slasher is saying does not match your game, there must be some setting that is wrong. Check the AudioType of your clips. Make sure that:

-aKako.AudioType is Music
-aPsh.AudioType is Sound (or AmbientSound)

If that's already true, something else is wrong. In that case, go have a look at each AudioType (Audio | Types in the project tree, double-click on one to open). Check what MaxChannels is set to for each one. You probably ought to have:

-Music.MaxChannels is 1
-Sound.MaxChannels is 0

If that also looks OK, come back.
YEAAAAAAAAAAAS finally (laugh) my problem solved ^^ the problem was my aPsh was on type:Music now i made it on type:sound Thank you Snarky and slasher and Khris and all who helped me Thanks a lot ;-D
Now i can start my NEW GAME ! (laugh)
SOLVED
#2
Quote from: slasher on Wed 12/04/2017 14:58:46
aKako only stops when you click on the button and go to the next room as you have scripted aKako to Stop in room 2..

When a sound is played it should not stop the background music...

Also the gIconbar should be visible=false when in the first room.

Also gui z orders need setting (z order = order of which gui is on top / at back)

'Regions' are generally used for this type of command
Code: ags
function hHotspot1_WalkOn()
{
player.ChangeRoom(3, 246, 420);
}


If you take the key then the key on the table should be an object that disappears when you take it as it gets added to your inventory.
Thanks i will edit all this in my project :) but you forgot to tell me how to fix my final problem >.>
Quoteany idea how to make the music background(aKako) never stop when another sounds play ?

This is the final code i used in the Menu room:
Code: ags
function room_Load()
{
aKako.Play();  // play music
}
bool wasOverButton = false;
function room_RepExec()
{
  bool isOverButton = GUIControl.GetAtScreenXY(mouse.x, mouse.y) == Button1;
  if (isOverButton && !wasOverButton) aPsh.Play();
  wasOverButton = isOverButton;
}

i don't understand why the musics stops when the sound Psh starts... :~(
#3
Quote from: slasher on Wed 12/04/2017 04:43:30
Just to ask... is aPsh actually in the sound branch.. sounds like you could have added it to the music branch of the audio tree?


how simple was that >.< my sound was in the music folder i move it to sound folder now everything is fine when i aim i hear the sound once only every time i aim,
But the music stops...any idea how to make the music background(aKako) never stop when another sounds play ?  Thanks :)

(The Final Problem)
#4
Quote from: Snarky on Wed 12/04/2017 00:12:27
You're hardcoding the coordinates of the GUIControl.GetAtScreenXY() call instead of using mouse.x and mouse.y like Khris showed you. So instead of checking whether the mouse is over the button, you're checking whether the button is where it's supposed to be, which will always be yes.
oh i thought i should change it to x and y position of the button... anyway i fix it and now the code is this
Code: ags
function room_Load()
{
aKako.Play();  // play music
}
bool wasOverButton = false;
function room_RepExec()
{
  bool isOverButton = GUIControl.GetAtScreenXY(mouse.x, mouse.y) == Button1;
  if (isOverButton && !wasOverButton) aPsh.Play();
  wasOverButton = isOverButton;
}


now when i run the game my background music (aKako)start normal, and when i aim at the button (Psh) sound starts but when it starts it stop my music(aKako) and it keep restarting...
for example: the sound is (Ding) so when i aim my mouse on the button my music stops and i hear (ding ding ding ding ding...)forever :/ even if i move my mouse outside the button area the Ding sound keep going...
Any idea how to fix:

  • Start sound once only.
  • background music(aKako) don't stop when i aim on the button.
  • Make the sound stop when i get out the button area
#5
First i have notice that my button is called Button1 sorry... :( Start_button is the GUI background name.
So i have tried both codes you gave me guys, one in global and one in the room event and both of them got the same problem:
When i start the game the sound Psh start and keep restarting again and again, i didn't aim my mouse i didn't even move it...
Here is the code i used and i have changed Start_button to Button1  as i said before Button1 is my button and Start_button is the GUI Here is the result:
In Global script:
Code: ags
bool wasOverButton = false;
function repeatedly_execute() {
  // Put here anything you want to happen every game cycle, even when
  // the game is paused. This will not run when the game is blocked
  // inside a command like a blocking Walk()
    bool isOverButton = GUIControl.GetAtScreenXY(155, 129) == Button1; // when the mouse is over Start_button
  if (isOverButton && !wasOverButton) aPsh.Play();  //   aPsh sound will play once each time whilst over Start_button
  wasOverButton = isOverButton;
  if (IsGamePaused() == 1) return;
  // Put here anything you want to happen every game cycle, but not
  // when the game is paused.
}


In room Event:
Code: ags
function room_Load()
{
aKako.Play();  // play music
}
bool wasOverButton = false;
function room_RepExec()
{
  bool isOverButton = GUIControl.GetAtScreenXY(155, 129) == Button1;
  if (isOverButton && !wasOverButton) aPsh.Play();
  wasOverButton = isOverButton;
}

i don't understand whats the problem... i have followed all the instructions the only thing that i have changed is
GetAtScreenXY(mouse.x, mouse.y) == Start_button; TO GUIControl.GetAtScreenXY(155, 129) == Button1;

Please help in this confusing problem >.<
  • If you know whats the problem in the codes ? then please tell me :)
  • Here is the game i am working on (this is an example game before i start with who wants to be a millionaire)Take a look and please tell me the code to fix :(
Download link for my project:
http://www101.zippyshare.com/v/WizzU5iK/file.html
#6
Problem 1: Solved by adding this code to my room to invisible the button :D Thanks
Code: ags
Start_button.Visible=false;


Problem 2:didn't work :((i am using Gui button and what i want is to hear a sound(aPsh) when i move the mouse over the button)

i tired what you guys said and here is the result:

Quote from: slasher on Tue 11/04/2017 02:44:41
Check in help manual for: GetAtScreenXY

Examples in Global Rep Exec
Code: ags

}
  if(GUIControl.GetAtScreenXY(mouse.x, mouse.y) ==Button3){  // If over a gui button
   aKNOCK.Play(); // will play this sound when mouse over
   
}
  if(player.Room==3 && Object.GetAtScreenXY(mouse.x, mouse.y) ==object[5]){ // if over a room object
    aKNOCK.Play(); // will play this sound when mouse over


If the button is an object in room one then it should only show in room one and not two..if they are objects..
objects only relate to the room the are in.



I have tried that and the result is when i start the game the sound keep playing (and i didn't even aim my mouse at the button)the sound just keep playing again and again in all the rooms. here is the code i used:
Code: ags
function room_Load()
{
aKako.Play();  // play music
if(GUIControl.GetAtScreenXY(318, 157)){  // If over a gui button
aPsh.Play(); // will play this sound when mouse over
}
}

then i tired this code but when i run the game it gives me Error (line 4): undefined symbol 'button3'
Code: ags
function room_Load()
{
aKako.Play();  // play music
if(GUIControl.GetAtScreenXY(318, 157)==button3){  // If over a gui button
aPsh.Play(); // will play this sound when mouse over
}
}


Quote from: Khris on Tue 11/04/2017 10:39:37
I don't know how you implemented the button, but if you used a GUI, just set it to invisible before sending the player to the next room.

As for playing a sound: you wouldn't want the sound to run over and over again. Here's how to set that up:

Code: ags
// above repeatedly_execute() in GlobalScript.asc
bool wasOverButton = false;

  // add this *inside* repeatedly_execute()
  bool isOverButton = GUIControl.GetAtScreenXY(mouse.x, mouse.y) == Start_button;
  if (isOverButton && !wasOverButton) btnSound.Play();
  wasOverButton = isOverButton;

When i tired this code it gives me Error (line 4): Type mismatch: cannot convert 'GUIControl*' to 'GUI*' Here is the code i used:
Code: ags
function room_Load()
{
aKako.Play();  // play music
  bool isOverButton = GUIControl.GetAtScreenXY(314, 157) == Start_button;
  if (isOverButton && !wasOverButton) aPsh.Play();
  wasOverButton = isOverButton;
}

+i don't understand what bool code used for...

Any idea how to fix all this ? :undecided:

Information's about my project:
  • aPsh = The sound i want to play when i aim at the button.
  • I am using GUI button not object.
  • aKako.Play(); is just a code to play background music its working fine.
  • My GUI button name is Start_button

Please help in this final problem :~(
#7
Thank you so much guys ^^ every thing is working fine now ;-D i have animated the button When aim on it, and animated it when i click :3

Now i got another 2 new problems :-X if they got solved ill be so thankful :cheesy: And i can start my project to the NEW GAME ! :D Please help me :)

Problem 1:
So after i made the button code when click(player change room)to room 2(i was in room 1)the problem is The button keep showing in room2 i thought it will only show in room1 but looks like it comes to all my rooms :-[ Any idea how to fix ?

Problem 2:
is there is any way to add an audio when i aim at the button ?
Because in the events section there is only "OnClick" option.
i want to add an audio when my mouse aim on the button Is that possible ? :-\

(Thanks for your time).
#8
Quote from: slasher on Mon 10/04/2017 03:24:41
Right...

Are we talking gui control Button or an Object?
i am using object, because when i use gui button it keep showing that annoying background, i want my button to be png,
And in the event section there is only "click on button" option, there is no aim on button or mouse move on button Option.



But if you know how to delete the background in gui and how to animate the button in gui And how to position the button in GUI. then please tell me how :D

So i am now using Object(Start_button) and View3(animating Start_button) And character(player) and another character to talk to him(Dead)



This is the code for Menu room i used after you told me how to animate the button(Thanks again :))
Code: ags
function room_Load()
{
aKako.Play();  // play music
}
function Start_button_AnyClick()  // animate button
{
Start_button.SetView(3);
Start_button.Animate(0,25, eOnce);
player.ChangeRoom(2);
}

#9
Quote from: slasher on Sun 09/04/2017 16:33:21
As per Snarky

In the objects events property panel click interact and a function will appear in the room script.

Just add something like this as an example:

Code: ags

function StartGame_Interact() // AGS Adds this Interact function
{
player.Walk(oStartGame.X,oStartGame.Y+10,eBlock,eWalkableAreas); // player walks to start game object
player.Loop=3; // face object

// Animate object this like:
oStartGame.SetView(10) // or whatever view it is you have made
oStartGame.Animate(0,4,eOnce,eBlock); // will play loop 0 only once

// Do this like start the game etc
{


At least it's a start

Thanks :D now when i press on Start game it turns to green :)
but i didn't know how to animate when i aim on the button

Example:
When i move my pointer on the button or object i want it to change to another color
When i aim it turns to yellow when i out the area it goes back to red.

is that possible to make ? :) (Aiming on button animate) Thanks.
#10
Quote from: Cassiebsg on Sat 08/04/2017 21:55:32
Create a GUI, add a button to it...
Or create an object in the room and give it the "start game" sprite number, then change it to the green sprite number...

Or give us more info about what you have done so far and how you want your button to be.

i have created an object in my game and i give it the "start game" sprite and it works fine,but i don't know how to animate it
because there is only (talk to object,interact,etc...) there is no option for "walk over object" or aim on the object.
so when i aim(my mouse) at the "start game" it turns to another sprite(green,start game)
any way to do that ? :/

a screen shoot for what i have done:
   
#11
i don't understand"Set the buttons NormalGraphic property."
i don't have a buttons.... this is my question how to create a buttons then animate them >.<

can you explain more ? :3
#12
Hi,i want to make a game like "who want to be a millionaire" so the game is all about buttons.
My question is how to make a button in AGS ? and when i aim at that button it turns to green(for example)
i got the 2 pictures one is (Start game"red color") and i got another one (Start game"green color)
so how to create a button and when i aim on it how to change it to another picture(color). Thanks.
#13
Thank you so much it works perfect ! :D

i got one more question please :)


is there is anyway to change the game speed default ?
(the character moving so slow and lagy i keep going to the top of the screen and go to options and set game speed to max then it works fine)
is is there is anyway yo make it speed without changing the options in the game every time i play it ? :) Thanks.
#14
Hey, i am trying to tell ags whe ni activate the "key" in my inventory and press it on "the other character" do display text
but every time i run it, it gives me this error
end of input reached in middle of expression

here is the full code:

function Dead_UseInv()
{
if (player.ActiveInventory==key)(
(Display("you toke the dead key ! WOW..."));
}


SMF spam blocked by CleanTalk