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

#1
Nice! That is a much more elegant solution!

And since characters can be refred to from GlobalScript I can put that function in there and just call it on each room
#2
you're correct, my oversight.
#3
Thanks, I understand now :)

Luckily, I only need 1 bullet spark. The bullet being fired by the Player Character.

Regardless, each room will need it's own a "bullet spark" object to display, if I understood you correctly?

If for example, I wanted firefights between multiple participants you are suggesting saving the "bullet sparks" position and animation progress in arrays to quickly be able to assign and execute them, then afterward going through the array and emptying it of data?

My current implementation takes an existing object in the room and animates it while I have bullets remaining (global variable) and only executes if a mouse_up is detected so it's not auto-firing a whole clip in a fraction of a second.

Code: AGS
bool bFiring = false;
function CheckGunFire() {
   
//Check for GunFire
     if(Mouse.IsButtonDown(eMouseLeft) && Mouse.Mode == eModeReticle && !bFiring) {
          bFiring = true;
          
          if (intAmmo >= 1) {
               
          intAmmo -= 1;
          String ammo = "x "; ammo = ammo.Append(String.Format("%d", intAmmo));
          lblAmmoCount.Text = ammo;
          
          bulletspark.SetPosition(mouse.x - 14,  mouse.y + 18);
          bulletspark.SetView(4);
          bulletspark.Animate(0, 0, eOnce, eNoBlock, eForwards);
          bulletspark.Visible = true;  
               
          } else { cPlayer.SayBackground("I'm outta ammo!"); }
         
     } else if(!Mouse.IsButtonDown(eMouseLeft) && Mouse.Mode == eModeReticle) { bFiring = false; }
        
}
#4
Thanks :)

I did read the manual entry and it never mentions the String.Format function, only how to inject an integer value into a Display function using a special character (%d)

Display("The meaning of life is %d.", life);
http://www.adventuregamestudio.co.uk/manual/StringFormats.htm
#5
Thanks Khris, but I'm a little confused by what you mean.

Are you saying I can create Object(s) in the GlobalScript.asc file and then call them to be painted in an individual room?

Could you show me code to explain your suggestion? Thanks :)
#6
I am Trying to create a "bullet splash" where when I click somewhere on the screen a little "explosion" goes off.

Currently, each Room has an Object in it that contains the sprite, and when I click it plays the sprite.

Is it possible to dynamically create this object on the fly, play it's animation once and then dispose of it?

Here is my current implementation being executed continuously in function room_RepExec() :

Code: AGS

function CheckGunFire() {
     
//Check for GunFire
     if(Mouse.IsButtonDown(eMouseLeft) && Mouse.Mode == eModeReticle && intAmmo >= 1) {
          
      bulletspark.SetPosition(mouse.x - 14,  mouse.y + 18);
      bulletspark.SetView(4);
      bulletspark.Animate(0, 0, eOnce, eNoBlock, eForwards);
      bulletspark.Visible = true;
     }      
}
       
#7
I don't know why I can't find this in Search or on Google.

I can to convert an int to a String.

I've looekd in documentation, and I see you can convert String to int with .AsInt - but there doesn't seem to be a matching function to do it in the other direction

COuld someone clue me in please?
SMF spam blocked by CleanTalk