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 - Matti

#181
Isn't that what WiseFrog meant? That it worked in repeatedly_execute_always?
#182
I'm glad it worked out for you.

Unless you change those shallows-variables during the game you don't even need to use them. In that code you could just write Random(960) + 20;
#183
You can also significantly shorten your code if you use a loop to iterate through the objects.

Untestet:
Code: ags

  int Shallows_X = 960;
  int Shallows_Y = 960;
  
  for (int i = 1; i < 20; i ++)
  {
    int random_x = Random(Shallows_X)+20;
    int random_y = Random(Shallows_Y)+50;
    while (GetWalkableAreaAtRoom(random_x, random_y) != 1)
    {
      random_x = Random(Shallows_X)+20;
      random_y = Random(Shallows_Y)+50;
    }
    object[i].SetPosition(random_x, random_y);
  }
}
#184
Yes, that's the way to do it. Your first picture is a png, just the second is a jpg.

Welcome to the forums btw  :)
#185
Nice one :)

I recommend not using .jpg though, that ruins your art. Try .png instead.
#186
I think that number also registers clicks from guests, not only users with and account. Also, the number does not (neccessarily) represent different people as every click/page load counts in. Just refresh the site to see what I mean.
#187
Quote from: cat on Fri 09/04/2021 21:04:54
This got me stuck in your Youtube channel for almost an hour and I do not regret  :P

Same here   ;-D
#188
Looks and sounds promising!  :)
#189
Looking good!  :)
#190
The problem is that in your code the button won't be disabled if the background changes from sprite 51 to 52. To elaborate: In line 4, if the sprite number is 51 the sprite number will increase by one, but line 5 won't be called, because the sprite number was < 52 in line 4.

It should look like this:
Code: ags

if (gJournal.BackgroundGraphic < 52) gJournal.BackgroundGraphic ++;
 
if (gJournal.BackgroundGraphic == 52)
{
  bScissors.Visible = true;
  bNextPage.Visible = false;
}
else bScissors.Visible = false;
#191
Make sure you only change the equal sign in the comparison, not the other ones:

Code: ags
if (gJournal.BackgroundGraphic == 52) bScissors.Visible = true;
 
else bScissors.Visible = false;


Edit:
QuoteI also wonder where I should put the string that gives the character the item: before or after this if/else-statement?

Do you want the player to get the item as soon as they open the last page of the book or is the player supposed to click on the button?
#192
I just tried out the demo and it's quite cool. It really demonstrates how the camera features can be used in interesting ways. Especially the split-screen could be used for some fun multiplayer games.

A propos split-screen: That's what the arcade room is about, not hotseat. Hotseat means that players make their turns one after the other, not at the same time  ;)
#193
This sounds like it could be solved easily, but I don't really get it yet. What do you mean by this:

Quote from: Fribbi on Sun 28/03/2021 00:06:59
But how am I suppose to change the graphic on the same object again 12 times when it is sliding on the same region?

The luggage are 6 and it must go in x-ray first and come out as a normal luggage on the  slider.

My guess is that there are supposed to be six luggage bags moving from left to right, one after the other? Do they look differently? Are the x-ray images supposed to look differently?

Instead of using timers and regions you could simply check the x coordinate of the object and change it's graphic accordingly. Arjon's code should also work regardless of how many times the object is supposed to change it's graphic.
#194
The example for InvWindow.TopItem in the manual deals with exactly that  :)

Code: ags
while (InventoryWindow1.TopItem > 0) {
  InventoryWindow1.ScrollUp();
}
#195
If the sprite slots are consecutive, just do

Code: ags

if (GUI.BackgroundGraphic < x) GUI.BackgroundGraphic ++;  // x being the last book sprite
#196
Cool, I'm glad I've been helpul  :)

As for the lock-on: I assumed the monster(s) would move, that's why I used the character's coordinates. But if they don't your code for the mouse position is of course quite fitting  ;)
#197
Okay, so I tried out what I wrote above. I created a GUI for the Castbar and made it 80px wide. I created two global ints: Char_Lock keeps track of which character the mouse should hover over and Charge_Counter which determines how much the castbar has progressed.

EDIT: I just realized that your monster is an object, not a character. I think it should work the same way though, if you change character to object in that code.

This is the AnyClick function of the monster:

Code: ags
function cMonster_AnyClick()
{
  if (Mouse.IsButtonDown(eMouseRight) && Charge_Counter == 0)
  {
     Char_Lock = x;                         // x being the ID of the character
     Charge_Counter = 0;
     gChargeBarGUI.Visible = true;
  }
}


Then put this in the room's rep exec:

Code: ags
function room_RepExec()
{
  if (gChargeBarGUI.Visible)
  {
    if (Mouse.IsButtonDown(eMouseRight))
    {
      if (Charge_Counter < 80) Charge_Counter ++; // increase the castbar/counter. In this example, it increases 1 px per frame, so it's fully charged after two seconds (with the standard gamespeed of 40 frames per second).
      gChargeBarGUI.Width = Charge_Counter;
      // Edit: Forgot this part:
      if (Charge_Counter == 80)
      {
        // do stuff, e.g. shooting animation, damage calculation
        gChargeBarGUI.Visible = false;
        Char_Lock = 0;
      }
    }
    else 
    {
      Charge_Counter = 0;
      gChargeBarGUI.Visible = false;
    }
  }
}


And this has to go in the late_repeatedly_execute_always():

Code: ags
function late_repeatedly_execute_always()
{
  if (Char_Lock > 0)
  {
    if (Mouse.IsButtonDown(eMouseRight))
    {
      Mouse.SetPosition(character[Char_Lock].x + 2,  character[Char_Lock].y - 10); // locks the cursor position to the enemy character, the exact position may need to be adjusted
    }
    else Char_Lock = 0;
  }
} 


I think this works as intended, but could be improved. For example right now the cursor snaps to a certain position and you might want the cursor to stay where it is when right-clicking the monster.

Also I first wanted to increase the width of a button on the GUI but for some reason it didn't work. Increasing the width of the whole GUI did work, so I deleted the button. You might want to have some border or other graphics around the bar though.
#198
I would use the function where the enemy is clicked to start a timer variable and to lock the cursor on the enemy. Then, in the rep-exec I would check whether the button is still pressed or not. If the bar is full (e.g. the timer reached a certain value) damage is done and the cursor is unlocked. For the bar I would use a GUI button that increases in size according to the value of the counter, instead of using an animation.

Maybe later today I can test this and post a proper code.
#199
Can you explain exactly how it's supposed to work?

Do you want the player to hold down the right mouse button until the bar is filled up, and upon releasing the mouse button, damage should be done and an animation should play? And does the player need to hover over the enemy while doing so, or only when starting to hold the button down, or only when releasing the button?
#200
I'm not sure if this is sufficient or if you need to alter your system a bit, but you could just check the castbar's frame.

Code: ags
else if(mouse.IsButtonDown(eMouseRight) && oCast.Frame == x){ // x being the last frame of the animation 
SMF spam blocked by CleanTalk