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

Topics - jwalts37

#1
Hey Everyone!

This may sound like an idiotic question..but I really need some help understanding a few things.
What I'm doing is creating a mini-puzzle game where the user has to rearrange some puzzle pieces. Simple.
So heres what I have:
Code: ags

//at top of room script
int posX;
int posY;

function Drag(Object *Piece)
{
  posX = mouse.x - Piece.X;
  posY = mouse.y - Piece.Y;
    
     while (Mouse.IsButtonDown(eMouseLeft)
     {
        Piece.X = mouse.x - posX;
        Piece.Y = mouse.y - posY;
        Wait(1);
      }
}

Then in the object interaction function I simply used Drag(oPiece); etc
Which works exactly as it should. But heres the issue. I dont want to have to hold down click to drag it. I just want to click once. and have it lock to the mouse cursor. So I figured some sort of on_mouse_click would work. And I need This to happen constantly. So I figured i'd need to put something in repexec (which also confuses me because why when putting this code in the object interaction it runs like something would in repexec). But I cant do function on_mouse_click in repexec because i cant nest functions. This has my head spinning in circles. Do I need to do something like a processclick? OR do I need to use Any Click On Object event? Still, I am under the impression that having something stick with the mouse cursor at all times needs to be repeatedly executed ( but apparently object interaction events dont?). I am even more confused when I think about this. Maybe I'm not fundamentally understanding repexec.
Sorry to bug you guys!
-Thanks
-Josh

#2
Hello to everyone! And thank you for taking the time to read this!
So, I'm trying to create an Archery-type game and am having alot of issues. Let me first start off by stating that I am not writing this to be lazy and have someone else do things for me. I really like to know what I'm doing and love to learn new things. So, this archery game is a room in the game and is first person (pov). The background of the room is simply a tree a bit in the distance with a target on it. I thought alot about the best way to implement an aiming type system and came to the conclusion that i'd like to have something like this happen(and maybe some of these are impossible or extremely complicated, thats why im asking!):


  • The mouse pointer would be the crosshair (simple enough, thats no problem)

  • (This may be a bit complicated to implement, and if it is, does anyone have a better idea instead?) When mouse left-click is clicked and held, you'd (the user)  would see a bit a zoom in towards the target (to simulate drawing the bow back) and the crosshair now shutters about, or randomly jitters to make aiming at the target harder. And the zooming thing could simply look like the one in this game Golden Arrow Flash Game
  • So now the crosshair is randomly moving around and shaking, the user still has the left-click being held. The user places the crosshair over the target and releases the left-click.
  • A smaller "window" (? dunno what to call it) would be up at the top left of the screen and a red X would show where you hit the target (where the user let go of the left-click).
  • Maybe at some point I could make something like an arrow animation going towards the target. Kind of like if you've ever played the game "Conquest Of The
    LongBow" the old Sierra game.

This may sound really newbie-like (that's what I am with AGS). But I'm really having a hard time implementing any of this. Steps 2-5 above is what i'm having trouble with and its quite discouraging to me because I see alot of you guys doing unbelievable things with your games. Hopefully one day ill be there too! But for now I'm willing to ask for some help/guidance. Any feedback is appreciated! So again, thank you for even taking the time to read this.
Thanks! -Josh

(PS: There are a few flash games that kind-of show what I mean, Gelert Archery is one )
#3
Hey guys,
My name is Josh and I recently started helping my brother in-law with the game hes making with AGS.
Let me first say I am no stranger to compiled/interpreted programming languages but I am completely new to AGSscript. Only been working with AGS and its scripting language for a month or two. I have a background with c# and php but mostly for web based applications. This is my first time doing any sort of game development. AGS confuses me and frustrates me with some of the things it does and some of the odd ways it works but I keep working at it. I find that I have trouble sometimes with the simplest things.

----------------------
Here's my first issue:
----------------------
So theres a room with a bunch of animated background objects doing simple stand-in-one-place animations. But theres a guy who has a cart of lobsters that he pushes across the room. We called him "oLobsterMan". He Comes on the screen from the left side and walks across to the right and off. That was all fine and dandy but I wanted to make it so he would back and forth with some time in between. It seemed SO simple but I had such a hard time figuring it out. I ultimately figured it out but to me it seems that there would be a simpler, more-efficient way of doing this. By the way. His view is called "LobsterCartMan" and LOOP 0 is his animation when hes facing right and LOOP 1 I took the same sprites and used the "flip all frames in loop".  So LOOP 1 is him facing left.

So at first, to have him just walk across the room I had this inside the "room_Load()" function:
Code: AGS

function room_Load()
{
    ...
    the other room objects being set visible, solid, SetView, and Animate
    ...  
    oLobsterMan.SetView(LOBSTERCARTMAN); 
    oLobsterMan.Animate(0, 5, eRepeat, eNoBlock, eForwards);
    oLobsterMan.Move(400, 194, 1, eNoBlock, eAnywhere);
}


The next thing I tried was this:
In the "room_RepExec()" function:
Code: AGS

function room_RepExec()
{
    if (!oLobsterMan.Moving)
     {
         oLobsterMan.StopAnimating();
         oLobsterMan.Animate(1, 5, eRepeat, eNoBlock);
         oLobsterMan.Move(-100, 202, 1, eNoBlock, eAnywhere);
     }
}

So now He walked across and walked back. But like I said, I wanted him to keep going back and forth with some time in between. So after doing ALOT of searching on the forums, reading and reading. I thought maybe it would be best to do it with a timer. So I added this in the "room_AfterFadeIn()" function:
Code: AGS

function room_AfterFadeIn()
{
    SetTimer(1, 500);
    .....
    rest of room/character code
    .....
}


And then down in the "room_RepExec()" function I put this:
Code: AGS

function room_RepExec()
{
    
    if (IsTimerExpired(1))
     {
         oLobsterMan.Animate(1, 5, eRepeat, eNoBlock);
         oLobsterMan.Move(-100, 202, 1, eNoBlock, eAnywhere);
         SetTimer(1, 500);

  
    if (!oLobsterMan.Moving && !IsTimerExpired(1))
     {
        oLobsterMan.Animate(0, 5, eRepeat, eNoBlock, eForwards);
        oLobsterMan.Move(400, 194, 1, eNoBlock, eAnywhere);

     } 

  }

}

It worked! BUT. I honestly feel like i'm doing this the hard way and there's a more efficient, easier, simpler way to do this.

I have one more issue.
The intellisense/(auto-complete) in AGS. When I open the game, ill open a script up and start typing "oLob" and the full object name shows up. Works just fine. Then ill run the game, or sometimes ill open another room or work on another script and then when i type "oLob" NOTHING comes up. And ill scroll through the autocomplete box and NONE of my objects show in there anymore. The only thing that comes up for him is "oLobsterMan_Interact" I have to close the program and re-open it. I seem to have to do this every 30 seconds. And it gets REALLY REALLY frustrating. Sometimes it works, then all of a sudden it doesnt. But it seems to only do this with objects. Everything else in the auto-complete come up just fine every time.
I apologize about the long and drawn out post guys but I figured i'd be thorough in my explanation of what im trying to do and what i've tried so far. Ive read through hundreds of forum posts, and maybe Im just not using the right words in the query.
If anyone has any suggestions on the animation and/or the auto-complete issue please let me know. Id really appreciate any and all feedback. Thanks guys!
-Josh
SMF spam blocked by CleanTalk