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

I've got a few helper functions which I think would be pretty much universally useful for making adventure games.

For example, this basic but super useful function:

Code: ags

function replaceInvItem(InventoryItem* turnThis, InventoryItem* intoThis)
  int index;
  for (int i = 0; i < invCustom.ItemCount; i++) {
    if (invCustom.ItemAtIndex[i] == turnThis) index = i;
  player.AddInventory(intoThis, index);

All it does is replace one inventory item with another at the same index, so if you're mixing drinks in the inventory, you'd just call:

Code: ags

replaceInvItem(iTomatoJuice, iBloodyMary);

Also note that invCustom needs to be changed to whatever the name of your inventory window is.

EDIT: My sincere apologies, I'm going to get myself into trouble by not reading the forum rules. I now realise this doesn't fit the guidelines for a module on this board.
I have a few of these handy functions which I think would be really helpful, especially for beginners, I was thinking of putting them together in a sort of handy-helper library.

They include handy functions that:
-capitalise the first letter of a string
-highlight the inventory cursor over a hotspot
-Character.InRect()  -check if a character is within a rectangle

If there's interest in this sort of thing, maybe we can put together an open source collection of handy helper functions?
following imagazzell's thread about custom character animation, I've been trying to streamline my own system.

It would be great if I could call cBob.angry(); to switch bob's speechView to the angry view.

I've finally got my head around extender functions, but what i need is a custom property which stores the angry view so the function can call this.ChangeView(this.angryView);

kind of like this:
Code: ags

function angry(this Character*)

Is it possible to add properties to all characters so this would work?

Edit: I actually figured this out moments after posting this. Doh!

so in the edit character dialogue, you can edit the schema, which adds a custom property for all characters. Pretty easy!
I've been working on a new rain module which will suit my aesthetic a bit better than some of the other ones out there.

After looking at a lot of pixel art, I find the most realistic ones don't animate the raindrops, but just randomly place them, but simulate refraction of the light and slightly desaturate and lighten from the background.

I think I'm on the right track, but there isn't a lot of detailed information about DynamicSprite and drawing surfaces (If I'm incorrect, please direct me to the relevant part of the tutorial!)

My code is posted below, I think that I need to create an overlay and draw a bunch of raindrops onto it, then reset it for the next rain. should be pretty lightweight if it works!

Thanks in advance to anybody who can help me with this!

Code: ags

function makeItRain(){
  //  set/reset overlay, using a sprite which is the same as the screensize, transparent colour
  //  overlay  = sprite 1234, etc...
  int howMuchRain = 10;             //to make 10 raindrops at a time
  int rainDropLength = 20;          //each drop is 1 pixel wide, 20 pixels long
  for (int i = 0; i < howMuchRain; i++)
    int coordX = Random(359);
    int coordY = Random(170);       //find random places for the raindrops
  DynamicSprite* raindrop1 = DynamicSprite.CreateFromBackground(GetBackgroundFrame(),
                                                                coordX, coordY, 1, rainDropLength);
                                                                //makes a raindrop from the background image
                                                                //would be better if it was from a screenshot,
                                                                //so includes objects, characters
  raindrop1.Tint(1, 1, 1, 20, 100); //slightly lighten and desaturate each drop

  DrawingSurface *surface = myOverlay;  //draw on the overlay
  surface.DrawImage(coordX, coordY-1, raindrop1.Graphic);       //place the raindrop 1 pixel higher than it's source
                                                                //creating a light refraction effect

Hi all,
this is my first post after lurking for a while.

I've been experimenting with customizing the "modernized VerbCoin" in the template which comes with the latest version of AGS. I love the template, it just needs some new sprites to match the aesthetic of the game I'm creating. However, I really want six verbs on the coin. I've been analysing the code and don't really understand how it positions the buttons, or how I would go about adding more?

SMF spam blocked by CleanTalk