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

#261
Good, thanks for the clarfications :)

Quote from: Khris on Wed 06/04/2011 14:37:52
Yes, you need a global sprite (or more precisely: a non-"local to the function" sprite), otherwise you end up with sprite 0.
Declaring the sprite just above the function will suffice.
Ah yeah, defining it just for the room makes more sense in this case.

Quotea) Afaik, yes. The reason I take it is that using .Now queries the system for the time/date once, storing all values in the members of the DateTime object, creating a consistent dataset of one precise moment.
While a few loops between queries to e.g. DayTime.Hour and DayTime.Minute usually don't skew the result, you could in theory end up with 7:00 when it is in fact 8:00 (because the clock just switched from 7:59 (hour = 7) to 8:00 (minute = 0)).
Though this wouldn't apply in other cases, like "mySprite.GetDrawingSurface().DrawCircle(...)" or "Character.GetAtScreenXY(...).SetAsPlayer()", which you also can't write.
But I see, none of these uses would actually make sense as a one-liner, the DrawingSurface in the first example must be released and hence be stored in a variable, and the character in the second example must be checked for null anyways... so yeah, it's probably to prevent people from running into problems with this in the first place.


Using sin/cos would be an alternative to draw a circle outline, yes. I just hoped there would be an undocumented function to set the border color separately or something. Maybe in the next release... (along with functions to draw polygons, ellipses and bezier curves... although I'm not sure I'd need them too often)
#262
Speaking of the GUI, I noticed it is no longer possible to click on the background to select the GUI in the properties editor, instead you have to select it in the dropdown list of the properties editor. (this worked in 3.1.2 SP1)

Also, if you change the size of GUI elements using the mouse, the width/height values don't update in the properties editor, only after deselcting and re-selecting the control. Works fine with left/top though. (this one didn't work in 3.1.2 SP1, too)
#263
I've not worked with raw drawing and dynamic sprites (or really any "advanced scripting" in AGS beyond ChangeRoom and Say) so far, and tried to make a simple animated real-time clock to test it out:

Code: ags

  //set the time (for now, just use current time)
  DateTime* dt = DateTime.Now;
  int gametimeh = dt.Hour;
  int gametimem = dt.Minute;
  int gametimes = dt.Second;
  //clock position and size
  int clockposx = 100;
  int clockposy = 100;
  int clockradius = 50;
  //draw it directly onto the background
  DrawingSurface* ds = Room.GetDrawingSurfaceForBackground();
  //draw the outline of a circle
  ds.DrawingColor = 15; //white
  ds.DrawCircle(clockposx, clockposy, clockradius);
  ds.DrawingColor = 0; //black
  ds.DrawCircle(clockposx, clockposy, clockradius-1);
  ds.DrawingColor = 15; //white
  //draw hands
  ds.DrawLine(clockposx, clockposy,
    clockposx+FloatToInt(0.6*IntToFloat(clockradius)*Maths.Sin(Maths.DegreesToRadians(IntToFloat(gametimeh)*30.0)), eRoundNearest), 
    clockposy-FloatToInt(0.6*IntToFloat(clockradius)*Maths.Cos(Maths.DegreesToRadians(IntToFloat(gametimeh)*30.0)), eRoundNearest), 3);
  ds.DrawLine(clockposx, clockposy,
    clockposx+FloatToInt(0.9*IntToFloat(clockradius)*Maths.Sin(Maths.DegreesToRadians(IntToFloat(gametimem)*6.0)), eRoundNearest), 
    clockposy-FloatToInt(0.9*IntToFloat(clockradius)*Maths.Cos(Maths.DegreesToRadians(IntToFloat(gametimem)*6.0)), eRoundNearest), 2);
  ds.DrawLine(clockposx, clockposy,
    clockposx+FloatToInt(0.9*IntToFloat(clockradius)*Maths.Sin(Maths.DegreesToRadians(IntToFloat(gametimes)*6.0)), eRoundNearest), 
    clockposy-FloatToInt(0.9*IntToFloat(clockradius)*Maths.Cos(Maths.DegreesToRadians(IntToFloat(gametimes)*6.0)), eRoundNearest), 1);  
  ds.Release();

This code is in the rep_ex_always function of a room.

Now, before you try to figure out what I did wrong: This works fine. ;)
It draws a clock with the current time on the background, and since the clock stays at the same position, it's not a problem that the original background is drawn over.

My main question is: Is this the right approach in terms of efficiency, performance, memory usage, and code style, or did I miss something? Would it be better or worse (unless necessary) to draw on an object/DynamicSprite than on the background?

And if I have to use a DynamicSprite, do I always have to store it in a global variable? So I can't just write something like
Code: ags
DynamicSprite* ds = DynamicSprite.Create(101,101);
DrawingSurface sf = ds.GetDrawingSurface();
//...draw clock on surface like before...
sf.Release();
oClock.Graphic = ds.Graphic;
ds.Delete(); //or not?
//end of function

in my rep_ex_always function, since the sprite would be deleted right after I assigned it (by the Delete function or by the AGS memory manager) and the graphic of oClock would fall back to and display the default sprite?

My other, general questions are:
a) Is it correct that I always have to use variables to store e.g. the datetime in order to access it? So there is no way to write something like "int hour = DateTime.Now.Hour;" like in similar programming languages, but I must write "DateTime* dt = DateTime.Now; int hour = dt.Hour;"?
b) Is it correct that there's no way to omit all these IntToFloats and FloatToInts other than storing each value in a float and int value in parallel (so, I would define "int clockradius = 50; float clockradius_f = 100.0;" for example)?
c) Is it correct that there is no other way to draw the outline of a circle than how I did it?

For b) and c) I found some older threads confirming this, more or less, but I want to make sure it hasn't changed since then.

Thanks for any confirmations and suggestions! :)
#264
How to use a flag: You uncoil it, then wave it over your head while jumping up and down until someone notices you.


What I called "flag" in the above post is just a boolean/binary variable/property/field/value, i.e. one that may be true or false, just like, as I said, oDoorClose.Visible. There's nothing more on how to use it other than what I already said.
#265
Since you already use the condition
Code: ags
if (player.ActiveInventory == iklaasjaveri) { ... }

in the other function, you should know what conditions look like (if not, read through any code you copy from somewhere to understand how and why it works, and consult the manual).
Now you want to know if the door is closed, so your condition is "oDoorClose.Visible == true" ("== true" may be omitted).
And in the {} (which may also be omitted if they contain only one line of code) comes what you want to happen on each room load when the door is still closed: that the walkable area is removed.
#266
The room_Load function is executed when entering (i.e. loading) the room, so the RemoveWalkableArea function is executed every time you re-enter it.

I see this issue was unfortunately not covered in the tutorial video you mentioned in the other thread.

You can use a flag in the room_Load function to determine whether the walkable area has to be removed or not. For example, here you can probably use oDoorOpen.Visible or oDoorClose.Visible in a condition.

btw,
1) wouldn't one of the door objects suffice? If you draw an open door in the background and put a closed door object on it, you can open/close it only with showing/hading this one object.
2) your naming for the objects doesn't seem too logical to me. If the vampire opens the door, you make the closed door (oDoorClose) visible and the open door (oDoorOpen) invisible?
#267
Great paintings, they will surely make a nice atmosphere for a game. I also think blending characters and especially objects is the hard part, and animating, and maybe also walk-behinds if there are any.
But if you have the opportunity to use great art for a game (and get enough backgrounds with the same setting and atmosphere for every location in the game), it's worth the effort, I think.

Only tunnel-like backgrounds like this one:

are maybe not the best for adventure games, you end up with a lot of not-so-beautiful character scaling and only a small walkable area.
#268
Yeah, read my post again... the error message gives the right hint. :)
#269
Combining more than 2 items: Yes, but only if the order is irrelevant or perfectly clear. I hate it when I know I have to combine several things but only one combination is allowed for no specific reason.
The same goes for combinations of more than 2 things that are split up in combinations of 2 things, all combinations should be possible if they make at least a bit sense.
And such combinations should only be used for easy puzzles. If you get stuck and have to desperately try all combinations of inventory items, it's annoying enough to try all binary combinations (especially if the order does matter).

Mouse over hotspots: If you mean that a label should appear if you move the mouse over a hotspot (or the hotspot should otherwise be highlighted), then yes, because otherwise it gets a pixel hunt unless the graphics are so simple that there are basically only the hotspots and characters visible.
#270
Quote from: beenf on Sun 03/04/2011 19:36:31
this is what I tried
Code: ags
function cVamp_Talk()
{
if object(0).Visible=true dVamp1.Start();
else if object(0).Visible=false dVamp.Start();
}


What are the error messages you got there? Not of any help?

- object is an array, its members are accessed with [], not ()
- comparisons are done with ==, a single = is only used to assign values
- conditions are enclosed in (), "if (object[0].Visible == true) dVamp1.Start();" ("== true" can be omitted here)

(all things you already did correct in the previous posts, why change it for the worse ;))
#271
a. will not work, only characters have a Say function.

But b. will: you can make characters invisible by setting their room to 0.
Either you do it like you intended, making them invisible when you pick them up with
Code: ags
cHam.ChangeRoom(0);

and visible again later with something like
Code: ags
cHam.ChangeRoom(player.Room,x,y);


Or you use an object which you hide and show, and use a character that is always in room 0 to say something, like
Code: ags

function oHam_Interact()
{
  oHam.Visible = false;
  cHam.Say("Help! I get abducted!"); //cHam is not in this room, but his speech appears
  player.AddInventory(iHam);
}


(the inventory item iHam is not affected by anything of this)
#272
Quote from: Ryan Timothy on Fri 01/04/2011 16:52:52
Quote from: Mati256 on Fri 01/04/2011 16:47:07
I can't load the video.  :-\
What country are you in? That might be the problem.
Also, YouTube seems to be quite slow today (I suspect them to prioritize videos from Partner accounts and such), it took a while for me to load, too.
#273
Thanks!

Matti, I'd love to see such a game, with or without this infinite loop. ;D

Giving a stick to a vampire seems indeed pretty logical. :)

Speaking of logical: While browsing for Domi's awesome video review again today, I found this video walkthrough of the game: http://www.youtube.com/watch?v=7Ir5kMUa4RA - they discovered a big flaw in the logic of my dialogs that I wasn't aware of, damn! :D

The stick and vampire heart thing just gave me another idea: When you include things like "headache" and "heart-attack" in the items list of the SillyStoryMaker (I just found out there's actually an iPhone app and a board game with that name, hopefully they don't sue me), there could be reasonable objectives like "To go into the house, you must first give the doorman a headache." - along with not-so-reasonable objectives like "pick up the headache" or "combine the headache with the cup", and in the end probably ending up with a headache as an inventory item, but well...
#274
Completed Game Announcements / Re: I Forgot...
Fri 01/04/2011 16:30:53
Nice atmosphere! :)


I give this game a 6 out of 10!

What do you say, no?

Okay okay, a 7/10.

No?

Alright fine, 8.5 out of 10, you can't be unhappy with that! :P

(that said, you should do more of your Indie Games Night videos :D)
#275
Looking good!
Nice to see that you make progress on this :)
#276
When I defeat an opponent, can I pick up his or her clothing/items and customize my player character? That would be cool!
#277
I'd call it "BigBlueCupboard" 8)

Considering that many AGS games use the default icon, it will hold many blue cups, just like a cupboard.
(and with the new design, it even is blue!)
#278
General Discussion / Re: Japan - Fallout
Thu 31/03/2011 16:29:26
Quote from: zabnat on Thu 31/03/2011 15:33:00
In the pdf values are in Bq/m3 and Bq/kg. Maybe she had some fancy formula to convert cubic meters to square meters and kilograms to square meters...
Oh, how I like it when journalists try to derive meaningful values on their own from the available statistics without knowing what they're doing...
#279
Congrats Pinback, well-deserved! :D
#280
Critics' Lounge / Re: A Tasty Verbcoin
Wed 30/03/2011 23:29:52
The final version looks good! :)

@OT melting verbcoin: reminds me of coming out of the aliens' humming machine in Zak McKracken, only the reverse effect.
SMF spam blocked by CleanTalk