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

#1
Haha I guess now Im confused. I had added an option in preferences to change the theme.

At the time I couldn't figure out how to refresh real-time so the current script had to be reopened. But I actually ended up figuring out how to redraw/fresh it. I dont remember this option being in any of the major releases. Is that what you meant?
#2
Also, the 3.3.3 version doesnt seem to be working.
#3
I actually did the same thing recently, except I had added an option to change themes from the preferences menu. The thing that bugged me was that whenever you switched it, the script had to be reopened in order for changes to take effect. I finally figured out how to "refresh" it real time. Its been so long since I was in there but if you'd like to get together and work on this feature or something ChamberOfFear, let me know. I was always too afraid to post my changes here for fear of all the exceptional programmers being like "THIS IS GOD AWFUL SHIT" even though I know they wouldnt. Let me know!
-Josh
#4
Nevermind,
Sorry guys I figured it out.
What I did was create a bool that gets set to true when the object AnyClick event is fired. And in the RepExec I just did if (isclicked == true) and set the object to the mouse. Sorry for wasting a post.
Take care
-Josh
#5
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

#6
K so, I got it working (in a very, VERY elemental state) Heres the code so far:
Code: ags

// room script file

function room_AfterFadeIn()
{
  
  mouse.UseModeGraphic(eModeCrosshair);
  gIconbar.Visible = false;
  oProjectile.Visible = false;
  
 }
 
  bool bow_pull = false;              // Game State


function crossHairShutter()           // All royalties go to Khris for this set of code. I have a hard time understanding it. But im trying! Thanks Chris!
{  
  slow++;
  if (slow < 2) return;
  slow = 0;
  
  #define bound Maths.Pi*2.0
  
  timer_a += 0.1;
  if (timer_a > bound/2.0) timer_a -= bound;
  
  float t = timer_a;
  
  #define x Maths.Sin(t)
  #define y Maths.Sin(t*2.0)*0.5
  
  float x1 = x;
  float y1 = y;

  #define f 2.0
  #define s 0.4
  
  t = t + s;
  if (t > bound/2.0) t -= bound;
  
  float x2 = x;
  float y2 = y;
  int vx = FloatToInt(f*(x2-x1), eRoundNearest) + Random(2)-1;
  int vy = FloatToInt(f*(y2-y1), eRoundNearest) + Random(2)-1;
  
  Mouse.Update();
  Mouse.SetPosition(mouse.x + vx, mouse.y + vy);



function room_RepExec()
{
 
  oWeapon.X = mouse.x - 92;           //Did this to set the bow to the mouse's x axis only.
                                      //I also wanted the bow's arrow to be vertically aligned with the crosshair, but I noticed a large offset to the left,
                                      //and I realized its because of the bow sprites bounding box. The sprite is 170x150, so I thought i'd divide by two which
                                      //was 85. And that wasnt right, So trial and error began. Theres gotta be a better way. 
                                      //Maybe mouse.x - (Game.SpriteWidth[corsshair_slot] / 2)? Im awful with math, except for with music. 


  if (mouse.IsButtonDown(eMouseLeft))  
    {
      bow_pull = true;
      crossHairShutter();
    }  
     
    else if (!mouse.IsButtonDown(eMouseLeft) && bow_pull == true)
     {
       oProjectile.Visible = true;
       oProjectile.X = mouse.x - 3;            //again, very strange math logic here, I dont know why it was like this. The crosshair sprite is 32x39
       oProjectile.Y = mouse.y + 4;
       bow_pull = false;
     }
       
  }


And so there is the very simple implementation. I realized I was probably going too far with it as this isn't an archery-only game. Only problem with above is that the user could just double click and get a shot. So im thinking about combating that by implementing a sort of power meter that will force the player to hold left click for a certain amount of time (the strength bar will show red when its okay to shoot). And a scoring system. Which i'm thinking the easiest way to do is make each ring of the target a hotspot etc etc. Thanks for all your help gentlemen. Let me know what you think.

PS: why is the
Code: ags
 function not working? or is it just on my end?


Edited by mod: Yeah, it's a bit confusing, as you need to use [code=ags] instead. The fact that the button in the tool-bar still generates [code] doesn't help, but as far as I remember, AGA said it's some kind of hack to the forum software for AGS scripts to work, and there isn't much that can be done to fix it ATM.
#7
Hey thanks for the replies guys and I apologize about the vague questioning. After a bunch of research, I finally got the mouse jitter working perfectly and it happening while the left mouse is clicked. I guess all I need to figure out now is the best way to actually represent the arrow shooting towards the target. And I was thinking scoring wise, To create a target (dynamicsprite maybe?) and make an overlay over each target ring (or draw a hotspot on each ring). But first things first which is representing shooting the actual arrow. I could either do it with some sort of crazy parabolic function or I could do it pseudo-like with scaling, like you said. But im still a bit new even with that. The target is in the distance on the field, and the arrow would most likely be an object and I know that characters have continuous scaling but i dont think objects do. Thanks guys.
#8
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 )
#9
Khris,

Thank you so much for your reply. This is all so new to me. About the auto-complete. I didn't to come off as saying that it sucks and I was smarter than it. I apologize for coming off that way. Something you said actually helped my brother-in-law and I figure out the issue. You said something about scope. So I went back and looked and I wasn't using any of these objects' functions globally, they were all inside the rooms script. So my brother-in-law (who's worked with AGS for much much longer than I) said maybe the room needs to be opened in order for the script to be able to access the rooms objects ...DUH..(I felt extremely stupid!) and sure enough, he was right! It worked!. See, I had just opened the rooms script and closed the actual room editor. So thank you very much for helping me/us figure this out. I really appreciate it! Everyday I learn some new quirk about AGS. Its very picky. But I think AGS is an incredible piece of software. Something i'm REALLY starting to enjoy learning and working with. Take Care!
-Josh
#11
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