Show Posts

You can view here all posts made by this member. Note that you can only see posts made in areas to which you currently have access.


Messages - Khris

Pages: [1] 2 3 ... 422
1
Sure:
Code: Adventure Game Studio
  1.   DateTime *dt = DateTime.Now;
  2.   int days = 31, m = dt.Month;
  3.   if (m == 2) days = 28;
  4.   if (m == 4 || m == 6 || m == 9 || m == 11) days = 30;
  5.   int day = dt.DayOfMonth;
  6.   int year = dt.Year;
  7.  
  8.   day += 3;
  9.   if (day > days) {
  10.     day -= days;
  11.     m++;
  12.   }
  13.   if (m == 13) {
  14.     m = 1;
  15.     year++;
  16.   }
  17.   cEgo.Say("Best Before: %02d/%02d/%04d", day, m, year);

2
Yeah, these are all side effects of the module.

You can emulate walkbehinds using non-clickable objects.
As for hotspot text, you'd have to manually detect everything. It's a lot of work but doable. (As in, compare each character's position to the mouse position, determine if the pixel is within the current sprite and not transparent, same for objects. Hotspots are easy, you can get them using Hotspot.GetAtScreenXY().)

3
A really quick fix, disregarding inventory items:

Code: Adventure Game Studio
  1. function on_mouse_click(MouseButton button) {
  2.  
  3.   int mode = eModeWalkto;  // default
  4.  
  5.   int lt = GetLocationType(mouse.x, mouse.y);
  6.  
  7.   if (button == eMouseLeft) {
  8.     if (lt != eLocationNothing) {
  9.       if (lt == eLocationCharacter) mode = eModeTalkto;
  10.       else mode = eModeInteract;
  11.     }
  12.   }
  13.   else if (button == eMouseRight) {
  14.     if (lt != eLocationNothing) mode = eModeLookat;
  15.   }
  16.  
  17.   ProcessClick(mouse.x, mouse.y, mode);
  18. }

4
I have played around with this and I can't get it to work properly.

As far as I can see, the idea is to import the background three times, then use a) FakeScreen.Enable(2, 1, 199), which basically creates a screenshot and draws it to background frame 1, and b) Underwater.Enable(), which takes background frame 1 and draws a distorted copy to background frame 0.
It does work, kind of, but I get artifacts and the distortion looks odd, as if it's not properly reset each frame. It doesn't look as clean as in the demo.

Edit: actually, it does.

Ok, here's what I did:

-I imported the same background three times, adding two background frames to the default one.
-I drew a walkbehind covering the screen, setting its baseline to 199
-I put this in room_AfterFadein:
Code: Adventure Game Studio
  1.   FakeScreen.Enable(2, 1, 199);
  2.   Underwater.Enable();
Note that the FakeScreen module should be above the UnderWater one in the project tree, so that FakeScreen's repeatedly_execute is called first.

5
I looked at the module and the function is defined as:

function Enable(int frameToCopyFrom, int frameToCopyTo, int baseLine);

The first two parameters are referring to background frames, which are numbered from 0 to 4.
I don't know exactly what this module does; I assume it creates a copy of the current screen by drawing characters and objects to a background frame, in order to allow the image to be distorted, right?

6
You need a check for mouse.Mode == eModeUseinv.

Also, Game.DoOnceOnly() on its own doesn't do anything. All it does is return something, which means it must go inside an if's condition brackets.

Also, this is once again a classical state change situation; you should avoid calling code every frame unnecessarily.

Code: Adventure Game Studio
  1. bool sonar_was_over_clamp;
  2. int timer;
  3.  
  4. function room_RepExec()
  5. {
  6.   bool active_sonar = cshifter.ActiveInventory == isonar && mouse.Mode == eModeUseinv;
  7.   Character* under_mouse = Character.GetAtScreenXY(mouse.x, mouse.y);
  8.  
  9.   bool sonar_is_over_clamp = (under_mouse == clamp && active_sonar && gInventory.Visible == false);
  10.  
  11.   // buzzing
  12.   if (sonar_is_over_clamp)
  13.   {
  14.     timer++;
  15.     if (timer >= GetGameSpeed() / 2)   // play aBuzz every half second
  16.     {
  17.       timer = 0;
  18.       aBuzz.Play();
  19.     }
  20.   }
  21.  
  22.   // sonar just moved over clamp
  23.   if (sonar_is_over_clamp && !sonar_was_over_clamp)
  24.   {
  25.     mouse.ChangeModeView(eModeUseinv, 10); // Runs inventory cursor view animation
  26.   }
  27.  
  28.   // sonar no longer over clamp
  29.   if (sonar_was_over_clamp && !sonar_is_over_clamp)
  30.   {
  31.     mouse.ChangeModeView(eModeUseinv, 0); // Stops inventory cursor view animation
  32.   }
  33.  
  34.   sonar_was_over_clamp = sonar_is_over_clamp;
  35. }

Tracking a condition like this allows you to call code exactly once, whenever the condition changes, as opposed to continuously every loop.

7
Critics' Lounge / Re: Anasazi head for eval...
« on: 19 May 2013, 13:03 »
It looks like they're looking up; in a frontal view, the face should be a bit further down (the eyes halfway down).
It also needs contrast; the faces look like seen through fog.

8
Critics' Lounge / Re: 3D Alien Buildings for Game Design
« on: 18 May 2013, 08:45 »
You can embed videos (second row, second button).

<a href="http://www.youtube.com/v/Xe00cO1luEU&fs=1" target="_blank" class="new_win">http://www.youtube.com/v/Xe00cO1luEU&fs=1</a>

9
Beginners' Technical Questions / Re: High HD res on AGS
« on: 18 May 2013, 08:39 »
Available high resolutions are 800x600 and 1024x768.

As for a widescreen format, you can use 640x400 (16:10).

10
Beginners' Technical Questions / Re: SCM files help
« on: 17 May 2013, 09:21 »
In AGSEdit, right-click the script node in the project tree, then click "import...".

11
Both are easily possible, and my code was faulty anyway.
It should work now even if the mouse goes directly from button to button. I also added a check for the GUI; just replace "gMenu" with your menu GUI's name.

12
All you need is a pointer:
Code: Adventure Game Studio
  1. Character* Player1;

13
Not sure what exactly the problem was, but it doesn't matter what you use as text for Game.DoOnceOnly, as long as the String is unique. I could've used Game.DoOnceOnly("Yabba Dabba Doooh!"); in my code and it would still work just fine.
Of course, something like Game.DoOnceOnly(oAbigail); will not work; it needs to be text. This on the other hand should work fine: Game.DoOnceOnly(oAbigail.Name);

All the function does is keep a list of used texts. At the beginning, it is empty. When Game.DoOnceOnly is called, AGS looks up whether the text is already in the list. If it isn't, the function returns true, otherwise false. Then the text is added to the list.
The cool thing about this is that you can use the command in a situation where the player can do either one of two things but not both. Imagine two levers, and one will open the door, while the other will also do that but hurt the player first. If both levers use the same String in their Game.DoOnceOnly(), the player can't pull the other lever after having pulled the first one, all without any additional variables and checks.

14
You need a state change loop, like this:

Code: Adventure Game Studio
  1. // this line above repeatedly_execute_always
  2. Button *old_button;
  3.  
  4.   // inside repeatedly_execute_always
  5.   GUIControl *gc = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
  6.   Button *b;
  7.   if (gc != null) b = gc.AsButton;
  8.  
  9.   if (b != old_button && b != null) { // mouse has just entered a button
  10.     if (b.OwningGUI == gMenu) {
  11.       // code here, e.g. aButtonSound.Play();
  12.     }
  13.   }
  14.   old_button = b;

Edit: corrected code

15
This should do it:

Code: Adventure Game Studio
  1. function hPuente_WalkOn()
  2. {
  3.   if (Game.DoOnceOnly("fantasma abigail")) {
  4.     aFantasma.Play();
  5.     oAbigail.Visible = true;
  6.   }
  7. }

What errors did you get? (Just curious, maybe the manual entry isn't clear enough on how to use the command.)

Also, if you want to check for the player walking somewhere, you shouldn't use hotspots (the "player stands on" event is included for legacy reasons, using them that way is obsolete). That's what regions are for. In addition to a continuously firing event, they also have events for stepping on and off of them.

16
Do this instead:
Code: Adventure Game Studio
  1.   String dir = "Graphics";
  2.   String filename = "Bla.bmp";
  3.   String path = String.Format("%s/%s", dir, filename);
  4.  
  5.   DynamicSprite* sprite = DynamicSprite.CreateFromFile(path);

17
Are you using player.LoseInventory() to remove the carrots?
If you do, and removing the last one doesn't set player.ActiveInventory to null, you simply have to do it yourself.

18
It's a shot in the dark, but worth a try I guess. Restore/SaveGameSlot aren't executed until the current function has finished, so what I suggested shouldn't make much of a difference, but maybe it'll help.

19
Yay, I always knew that being German would come in handy at some point :-D

Great work, especially the graphics, but that's to be expected with you being a professional graphic designer and all :)
The only thing that's missing are default responses for unhandled interactions.

20
The Rumpus Room / Re: Name the Game
« on: 13 May 2013, 11:54 »
Somebody created a 1:1 Windows version of Castle Adventure, in case you want to wallow in nostalgia :)
http://www.benshoof.org/blog/castle-adventure/

Pages: [1] 2 3 ... 422