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

#1541
SetViewport doesn't centre the coordinates you specify within the viewport. You use it to set the top/left of the viewport. You're probably finding that the viewport is stuck showing the bottom of the screen. To centre your character vertically at all times, you could try something like this:

Code: ags
SetViewport(0, cManhat.y - (System.ViewportHeight / 2));


Or even something like this if you want the middle of the character:

Code: ags
ViewFrame *frame;

frame = Game.GetViewFrame(cManhat.View, cManhat.Loop, cManhat.Frame);
SetViewport(0, cManhat.y - ((Game.SpriteHeight[frame.Graphic] + System.ViewportHeight) / 2));
#1542
The Rumpus Room / Re: Happy Birthday Thread!
Mon 30/06/2014 11:12:29
Wow! Thanks for the birthday wishes, Adeel and AprilSkies! I had a great one. It was a lot of fun. The best birthday present would be hearing that you got that mic, Adeel.
#1543
> Eat the seamstress
#1544
Nikolas, nice try, but I'm not giving any details away about puzzles. I think the lack of modern conveniences will lead to greater variety in the puzzles. You won't just be able to search for clues/answers using your phone.

Wow, thanks for the words of encouragement, SarahLiz, Adeel, ThreeOhFour and Nikolas! We're really motivated by the praise. Going to try to live up to those expectations.

Status report for the end of June:

Some numbers:
- 10/35 playable rooms
- 1 playable quest

Surprise, surprise, I got less done than I'd hoped this month. I restructured a lot of the code so that my GlobalScript is now just a series of stubs. I think this is the nicest way to organise things.

We've got sounds! Hooo boy have we got sounds. Everything makes noises. The doors, footsteps... well, that's it for now. But the footsteps are in stereo, which sounds really nifty. I also have a few music demos from an (as of yet) unnamed contributor. I've been giving those a listen and they sound very promising.

The game is divided into a series of quests that you can track through a Progress dialogue box. They work in a similar way to achievements, but consist of several points each and contribute to an overall score (e.g. 4/5 + 3/5 = 8/10 total score). As noted above, the first quest is playable, but it still needs some work to flesh out descriptions. Plus, it's only really completable for one of the two characters right now (gotta' fix that).

We're really close to getting 2 more rooms in. Once I get those, I'll start fleshing out the next scene. For now, I'm going to focus on building backstory, hotspot descriptions and fleshing out the first quest more. Flesh.

I might wait a couple of months before giving the next production update. There wasn't really that much to report on this month :/. Things are going well though, and I'm still really motivated and genuinely happy with how things are working out! Until next time!
#1545
Hrm... your example is quite complicated and I couldn't really determine what everything was supposed to do, but I might have an idea as to why your if() statements aren't working.

In your first example, the basic structure of your repeatedly_execute_always is this:
Code: ags
function repeatedly_execute_always()
{
	if(cJake.x > 446)
	{
	}
	else if(background_animation == false)
	{
		SetTimer(1, 200);
	}
	else if(IsTimerExpired(1) == 1)
	{
		SetTimer(2, 200);
	}
	else if(IsTimerExpired(2) == 1)
	{
		SetTimer(1, 400);
	}
	else if((cMick.Moving == 0) && (checked_in == true))
	{
	}    
}


When you placed some of that code into the RollCall function, the structure changed so that it was:
Code: ags
function repeatedly_execute_always()
{
	if(cJake.x > 446)
	{
	}
	else if(background_animation == false)
	{
		SetTimer(1, 200);
	}
	else if(IsTimerExpired(1) == 1)
	{
		SetTimer(2, 200);
		if(IsTimerExpired(2) == 1)
		{
			SetTimer(1, 400);
		}
		else if((cMick.Moving==0) && (checked_in==true))
		{
		}
	}
}


Something was lost in the conversion to a function. Specifically, those if() statements inside your RollCall function do not recreate the else if() structure in your old repeatedly_execute_always function. That *could* be why your If statements inside the RollCall function never get reached. Right now, the second timer is only checked if the first timer has expired.

Also, just a casual observation, you're using the wrong and (&). The single & is for a bitwise and. You want && for logical and.

Perhaps try this (no guarantees!):
Code: ags
    // main global script file
     
    bool checked_in=false;
     
    function RollCall (Character*chartobecalled)
      {
         if(IsTimerExpired(1)==1)
{
       cMRandy.SayBackground("... Mick ...");
       chartobecalled.Move(516,  274, eNoBlock, eAnywhere);
       SetTimer(2, 200);
       chartobecalled.SayBackground("1");
}
         
  else       if (IsTimerExpired(2)==1)
           {
             checked_in=true;
             chartobecalled.SayBackground("2");
             chartobecalled.Move(200,  240, eNoBlock, eWalkableAreas);
             SetTimer(1, 400);
           }
          else if ((cMick.Moving==0) & (checked_in==true))
           {
            cMRandy.SayBackground("3");
            chartobecalled.ChangeRoom(3);
            checked_in=false;
            }
      }


and
Code: ags
// room script file
 
bool background_animation = false;
bool checked_in = false;
import function RollCall (Character*chartobecalled);
 
function repeatedly_execute_always()
 
  {
    if  (cJake.x>446)
      {
      oBubble.StopAnimating();
      background_animation=false;
      object[1].Visible=false;
      }
    else if (background_animation==false)
      {
      object[1].Visible=true;
      oBubble.SetView (28,  0,  1);
      oBubble.Animate(0,  10, eRepeat, eNoBlock);
      background_animation=true;
      SetTimer(1, 200);
        }
    else
      RollCall(cMick);
}


I think timers are a bad choice here. I have a feeling this won't work if you try to have multiple characters moving around at once. I suspect the timers (and global booleans!) will interfere with each other. I don't know if that's an issue for you. If it is, you might be best to have variables that exist for each character. Let's see if this fixes the if() statement problem first though.
#1546
Would have liked some extreme close ups.
#1547
Completed Game Announcements / Re: 8
Thu 26/06/2014 06:20:35
Quote from: Snake on Thu 26/06/2014 06:12:58
Why is 6 scared of 7?

Spoiler

Because 7-8-9
[close]

He is also a registered six offender.
#1548
Wow! Great looking game. The close-ups look magnificent.
#1549
Quote from: Joe on Fri 20/06/2014 21:16:49
You intrepeted it just right. I'll try to fit that line in your code:

Code: ags

function Bcatexterior_OnClick(GUIControl *control, MouseButton button)
{
  if (Bcatexterior.Text == "exterior is on"){
     Bcatexterior.Text = "exterior is off";
     playlist_category ^= EXTERIOR; //This will toggle EXTERIOR bit ...
  }
  else if (Bcatexterior.Text == "exterior is off"){
     Bcatexterior.Text = "exterior is on";
     playlist_category |= EXTERIOR; //this will add the EXTERIOR bit without modifying other bits so you can have combiantions
  }
}


Support for yer' new fangled assignment operators is hopefully coming in the next release. For now, yeah, you need to use the long form.
#1550
Bob SegerBäck Studios?
#1551
Well, actual compilation is not cross platform. That would be the big one. There's about half of a .NET-based compiler that's used for autocomplete and stuff.
#1552
Quote from: Crimson Wizard on Wed 18/06/2014 12:25:25
Quote from: Gurok on Tue 17/06/2014 23:55:50
Code: ags
    static Point *Point::Create(int x, int y)
    {
        Point instance;
        <...>
        return(&instance);
    }
    }

This looks like a very bad idea. You are going to return an address to object, allocated on stack. Besides, there's no '&' as "take address" and '*' as "dereference" operators in AGS... and for a reason: AGS was made as a Java/C#-like language, and you are suggesting to "downgrade" it to C-like language.

Yes, I know the object's allocated in stack memory, but it *kind of* would have worked for unmanaged structs as long as there were never pointers to them.

Anyway, yeah, looking into getting the "new" keyword working properly now. I've been messing around with things for about a day now and I feel /slightly/ more informed. There's a surprising amount that's already built. If you declare a struct as managed, you can have pointers to it and it compiles. You just can't do anything useful with it. So you're right. The "new" keyword is like the missing puzzle piece. Thanks!
#1553
The Rumpus Room / Re: *Guess the Movie Title*
Wed 18/06/2014 21:39:12
Dude, that is so smooth.
#1554
And it's over :(
#1555
As CW mentioned, dynamic creation of user structs is quite involved.

I haven't coded this yet, but I was thinking something like this might work for passing structs without needing to manage them:

Header

Code: ags
    struct Point
    {
        import static Point *Create(int x, int y);
        import float DistanceTo(Point *target);
        int X;
        int Y;
    };


Module

Code: ags
    static Point *Point::Create(int x, int y)
    {
        Point instance;
     
        instance.X = x;
        instance.Y = y;
     
        return(&instance);
    }
     
    float Point::DistanceTo(Point *target)
    {
        int dx;
        int dy;
     
        dx = this.X - target.X;
        dy = this.Y - target.Y;
     
        return(Maths.Sqrt(IntToFloat(dx * dx + dy * dy)));
    }

     
Example Usage

Code: ags
    float myFunction()
    {
        Point a;
        Point b;
     
        a = *Point.Create(3, 3);
        b = *Point.Create(6, 7);
     
        return(a.DistanceTo(&b)); // 5.0
    }


Too complicated?
#1556
Can we do the archaic letters like ash, yogh, eth and thorn? Ampersand too? Thorn is easy as you can just transcribe modern words. Eth too to some extent. For others, the Ænglisc Ç·ikipÇ£dia is a good resource. :-D
#1557
"You younguns," Yaroslav yelped, "yield your yellow yo-yos yerne!"
#1558
Vatican vicars vetoed vasectomies. Voters vowed vengeance.
#1559
Yes, I vote for jwalt to have another go too! Something more general this time.
#1560
Nationalists need never neglect nettle nurseries now naturalists neutralised necrotic needles.
SMF spam blocked by CleanTalk