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

Topics - J.E.S.

#1
Why does this code work...

Code: ags

function hBedroomDoor_Interact()
{
if(Character.GetAtScreenXY(90, 210)==cSlade)
{
  player.ChangeRoom(2, 200, 265);
}
else if (player.View==2)
{
  player.ChangeView(1);
  player.Walk(90, 210);
}
else
{
  player.Walk(90, 210);
}

}



But this code doesn't...

Code: ags


function hSladesCouch_Interact()
{
  if(Character.GetAtScreenXY(210, 260)==cSlade)
  {
    player.ChangeView(2); //to sit on couch
    SetWalkBehindBase(1, 200);
  }
  else
  {
    player.Walk(210, 260);
  }

}



I want the script to check the position of my character before he can sit on the couch. If he is close enough he will be able to sit on the couch when it is clicked again. This code works fine when I want to change rooms and I also like the freedom of walking without eblock.
#2
I want to have the cursor graphic change depending on where it is in relation to the player. For example, it the cursor is on the right side of the player, the cursor will point to the right or whatever direction. I can easily code the basic 4 directions (up,down,left,right) but it gets a bit more complicated trying to code all the directions in between. Another to point out is, it appears that the character can move in a possible 16 different directions, so sometimes it doesn't walk exactly on a 45 degree angle, but on a 22.5. Any help would be appreciated.
#3
Is there a way I can import a new walk-behind mask depending on my characters actions or location? I have 2 images as an example of what I want to do. The image with the green cursor next to the sofa is the effect I want and the image with the red cursor is what I'm struggling with. Changing the baseline does not work because of my room being in isometric view and that particular object.

http://s96.photobucket.com/albums/l183/virgoman25/?action=view&current=Image6.png (What I want)
http://s96.photobucket.com/albums/l183/virgoman25/?action=view&current=Image5.png (What I don't want)


#4
Hello, I can't seem to figure out how to play a sound once and not loop when you mouseover a gui button. I tried experimenting with the code from this post :http://www.adventuregamestudio.co.uk/yabb/index.php?topic=28715.0 but I still can't get it right. What I'm trying to make is a gui that appears when you press escape to show the main game menu screen and when you mouse over a button, you'll hear a click sound. Thanks in advance.
#5
Instead of displaying messages the old fashioned way, I had the idea to display a comic book style speech balloon that appear next to my characters head when a hotspot is right-clicked. Here is my code:

Code: ags
function repeatedly_execute_always()
{
  //---------------------------------------Player Dialog GUI----------------------------------
  gPlayerDialog.SetPosition(player.x-20, player.y-70);
  
  //-------------------------------Right Click Actions On Hotspots-----------------------------
  
  if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[1])&&(mouse.IsButtonDown(eMouseRight)))
  {
    gPlayerDialog.BackgroundGraphic=242;
    SetTimer(1, 120);
  }
  if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[2])&&(mouse.IsButtonDown(eMouseRight)))
  {
    gPlayerDialog.BackgroundGraphic=155;
    SetTimer(1, 120);
  }
  if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[3])&&(mouse.IsButtonDown(eMouseRight)))
  {
    gPlayerDialog.BackgroundGraphic=244;
    SetTimer(1, 120);
  }
  if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[4])&&(mouse.IsButtonDown(eMouseRight)))
  {
    gPlayerDialog.BackgroundGraphic=245;
    SetTimer(1, 120);
  }
  if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[5])&&(mouse.IsButtonDown(eMouseRight)))
  {
    gPlayerDialog.BackgroundGraphic=246;
    SetTimer(1, 120);
  }
  if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[6])&&(mouse.IsButtonDown(eMouseRight)))
  {
    gPlayerDialog.BackgroundGraphic=247;
    SetTimer(1, 120);
  }
  if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[7])&&(mouse.IsButtonDown(eMouseRight)))
  {
    gPlayerDialog.BackgroundGraphic=248;
    SetTimer(1, 120);
  }
  if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[8])&&(mouse.IsButtonDown(eMouseRight)))
  {
    gPlayerDialog.BackgroundGraphic=249;
    SetTimer(1, 120);
  }
  if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[9])&&(mouse.IsButtonDown(eMouseRight)))
  {
    gPlayerDialog.BackgroundGraphic=243;
    SetTimer(1, 120);
  }
  if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[10])&&(mouse.IsButtonDown(eMouseRight)))
  {
    gPlayerDialog.BackgroundGraphic=250;
    SetTimer(1, 120);
  }
  if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[11])&&(mouse.IsButtonDown(eMouseRight)))
  {
    gPlayerDialog.BackgroundGraphic=251;
    SetTimer(1, 120);
  }
  if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[12])&&(mouse.IsButtonDown(eMouseRight)))
  {
    gPlayerDialog.BackgroundGraphic=252;
    SetTimer(1, 120);
  }
  if (IsTimerExpired(1)==1)
  {
    gPlayerDialog.BackgroundGraphic=0;
}
}


This works like I would expect it to. However, if you just continue to hold the right mouse button down the whole time, you can move the cursor over every hotspot to reveal a speech balloon. I do not want this to happen. What I would rather do, is to somehow disable the rest of the hotspots when another hotspot is active. This way, one speech balloon would always be displayed and the player would have to right click again on a different hotspot to see its particular speech balloon. I mainly want to prevent players from holding down right-click and scrubbing the screen until they find a hotspot.

I'm familiar with:

Code: ags
hotspot[1].enabled=true/false


but I'm not quite sure how I would code the conditions to make a hotspot active again and still be able to only show one speech balloon at a time when right-click is held down. I hope this made sense, please let me know if I need to clarify. Thanks in advance.



#6
I've been tinkering around with some text effects I'd like to add to my game, but there was one in particular that had me stumped for a few days. What I had done was made a thin, black GUI with an invisible button in the center of it to display a description. When the cursor moves over a hotspot, a description will fade-in or fade-out when the cursor moves off of it. To create the effect of the text fading in or fading out, I created an image of the text and applied a text transition with another program. After I imported the text sprites, I created animation views. Here is what I have coded so far in my room script:

Code: ags


function repeatedly_execute_always()
{
  if((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[1])&&(Description.NormalGraphic==0))
  {
    Description.Animate(3, 1, 3, eOnce);
  }
  if((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[1])&&(Description.Graphic==146))
  {
    Description.Animate(3, 0, 3, eOnce);
  }
  if((Hotspot.GetAtScreenXY(mouse.x, mouse.y)==hotspot[0])&&(Description.Graphic==154))
  {
    Description.Animate(3, 1, 3, eOnce);
  }
}


While this code will work for 1 hotspot, I notice that if you move the mouse over the hotspot too fast, the animation doesn't always play; it only works if you move slowly over it. I believe there is a more efficient way to script my arguments, but I also have 12 hotspots in 1 room that need the same effect. I would appreciate any help with the correct approach I should take.
SMF spam blocked by CleanTalk