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 - Monsieur OUXX

#461
Sorry guys I had a crazy month (I think the other people in my game project have probably hired bounty hunters to get me by now). I'll check out my code and the state of the pull, as well as CW's comment asap.
#462
you should post this direclty in the thread of the module. Then you'll get support from its creator, Abstauber. I might have a look too tonight if I have time (not guaranteed)
#463
So let me get this right :
- so far you have not implemented the bouncing at all
- the bouncing menu entry is an object that appears only when the mouse is over it (otherwise it's ... what? a static image irectly in the room's background?)


I would recommend to use the Tweens module. That's the simplest way to have a nice smooth bouncing without having to worry about variables.
Do you know how to import a  module?
Get it from the module's page : http://www.adventuregamestudio.co.uk/forums/index.php?topic=51820.msg636508546#msg636508546

...then use a simple instruction like :
Code: ags


//in the function:
 ...
 else if (Hotspot.GetAtScreenXY(mouse.x, mouse.y) == hQuit){
      object[0].Visible = false;
      object[1].Visible = false;
      object[2].Visible = true;}

      object[2].TweenY(2.0, object[2].Y - 10,  eEaseLinearTween, eReverseRepeatTween); //the important line


You might need to use this if the mouse is not over the object anymore :
Code: ags

object[2].StopTweenPosition();


Please note that I can never remember if it's considered a bad thing to call .TweenY at every game loop and if the module is clever enough to not pile up a new tweening action every time, or if you have to be careful about that yourself. Then you'd need something like (not actual syntax) : if(object[2].IsTweening) { /*start the tween*/}
#464
Quote from: SinSin on Tue 25/09/2018 16:12:34
Ok thanks very much for the replies guys. I won't be using the variable in question too many times. It's mainly for a shop, I'll just work some if statements into to function to check whether the player has enough money to make a purchase.

Handy to know though. Thanks again.

I know that this question is 2 weeks old now, but if it's for a shop, then you'd be better off implementing a function like "can purchase":

Code: ags

int playerFortune = 100;

struct ObjectToPurchase {
    int price;
    import bool CanBePurchased();
}
ObjectToPurchase objectsForSale[10];

bool ObjectToPurchase::CanBePurchased() {
    return (playerFortune - this.price > 0);
}



in your game :
Code: ags


//player tried to buy object #6
if (!objectsforSale[6].CanBePurchased()) {
    player.say("That trumpet is too expensive.");
}
#465
Nice sprites, insomnia and cat! They're pretty.
Note: I can't see the other sprites because they're hosted on sites that are blocked by my workplace's firewall. But I'm sure they're pretty too.
#466
Completed Game Announcements / Re: Unavowed
Thu 04/10/2018 14:02:01
French magazine Canard PC gave it an 8/10, if I recall. Or at least 7.
They have a tendancy to be merciless with lazy games, and always take the selling price in account. Therefore, this 8 is good news. I always use Canard PC as a reference because they're the only French magazine (whether on paper or online) that does not bend over backwards for ads from large publishers in order to stay alive (unlike jeuxvideo.com, etc.)
#467
Critics' Lounge / Re: Little Sally
Mon 24/09/2018 16:37:55
Good sprite. Maybe boost the contrast and saturation a tiny bit? And try to make the hair's shading more interesting? (I wouldn't know how, though)
#468
Quote from: Duckbutcher on Thu 20/09/2018 16:17:09
Error is '.angle' is not a public member of 'ProjectileStruct'.

Well as you can see here :
Code: ags

struct ProjectileStruct
{
   ...
   float angleInRadians;
}


The member is named angleInRadians, not angle. Just change the name accordingly everywhere I made the mistake.

Since we're there, I suggest you change this :
#define PROJECTILE_SPEED 1.0
to this :
#define PROJECTILE_SPEED 5.0

This will make projectiles move 5 pixels during each game loop, instead of only 1 (they would be super slow and probably overlap)
#469
General Discussion / Re: Winzip or 7Zip
Fri 21/09/2018 15:49:21
Quote from: Slasher on Fri 21/09/2018 13:40:56
How universal is 7Zip regarding people being able to open and extract a game?

"computer-savvy" people (broad term) will know exactly what to do. For the others, I'd say 70% of the people using computers casually, it will be a nightmare and they will be angry at you for doing weird things that only a perverted weirdo nerd like yourself would do, just the same way your parents suspect you to "have installed a virus" the day you updated their printer's drivers.
#470
OK, if FollowCharacer was used to position the projectile at the same location as the player at the beginning of the shooting, then it makes sense, but I have a tendency not to trust an elaborate function to just teleport my object one time to a given location. I prefer to change .x and .y and be done with it. FollowCharacter might force the projectile to keep following the character or some unforeseen side effects of the same sort.

My code works as follows :

1) A bunch of #define to create some constants (that's some oddity inherited from ye olde C language).

2) Create 6 projectiles that I put in an array

3) the projectiles are "objects" (structs) where I store all the variables needed (x, y, angle, etc.). Each projectile also contains one Character* c, which is an actual AGS Character used to represent the projectile on-screen and move it around, just like you did yourself.

4) At game start, I bind Character* c of each projectile in the array to an actual AGS character that you must have created beforehand in the editor. It's the same idea as your dummy "cFire" character, except now there's 6 of them.

5) At each game loop, we check if the Space key is down and if the cooldown has elapsed (to prevent infinite instant firing). If yes, then we check if one of the 6 characters is "not in use" already, and if yes we place it at the same screen position as the player (+ or - 50 pixels, to make it start from the player's gun location) and give it an angle corresponding to the player's orientation.

6) At each game loop, we update the location of every projectile that is currently in use. that's your typical x = x+cos(angle); y=y+sin(angle)

7) At each game loop, we delete every projectile that is in use but has become too old. It's a way of recycling them to allow new projectiles to be created.
#471
Quote from: artium on Wed 19/09/2018 19:02:25
It is hosted on Github: https://github.com/alkhimey/HintsHighlight

EXCELLENT!


EDIT : Was- Was the github address at the top of the first post the whole time? :X
#472
Recruitment / Re: Offer Your Services!
Wed 19/09/2018 12:42:26
EDIT: my mistake
#473
Quote from: cat on Thu 13/09/2018 19:06:37
Why on earth can't they just provide a Windows installer?
Because linuxians. They like to capture the souls of innocent passerbys and torture them until they have entirely drained the will to live from them. They take a specific perverted pleasure in doing so by providing tools meant for Windows but made on Linux and yet not compiled for Windows.

What do you mean, "slightly biased comment"?
#474
did you host your source code online, on github or similar? It would be nice to always adopt that practice nowadays.
#475
Could it be some weird permissions issues on one of the game files? Could you check that you run the Editor as an admin?
#476
Thanks a lot! :cheesy::cheesy::cheesy::cheesy:
#477
Quote from: Mandle on Mon 17/09/2018 23:45:26
Quote from: Monsieur OUXX on Mon 17/09/2018 18:08:44
No one even mentionned Chronicles of Innsmouth, made with AGS!

Most of these posts are from 2016.
Oh yeah, I didn't notice the necroposting
#478
Do you have the .Net Framework and DirectX9 installed into your virtualized Windows 7?
#479
What people said. There's some interesting ideas mixed with some clunky aspects in the solution.
I defintely don't get what FollowCharacter has to do with it.

I'd go like this :
(not compiled, not tested)

Code: ags

#define MAX_PROJECTILES 6 //if you want to be able to fire repeatedly
#define COOLDOWN 30 //we allow the player to shoot once every 30 frames, which is approximately 500ms at 60FPS
#define PROJECTILE_SPEED 1.0 //how much the projectile moves during each frame
#define PROJECTILE_LIFESPAN 240 //A projectile can live up to 240 game cycles, which is 4 seconds at 60FPS

struct ProjectileStruct {
    bool inUse;
    Character* c;
    float x; //coordinates in float to free ourselves from moving the projectiles at speeds that must match exactly screen pixels
    float y;
    float angleInRadians; //Reminder : 360 degrees = 2*Pi
    int age; //how many game cycles have elapsed since it was created
};
ProjectileStruct projectiles[MAX_PROJECTILES];
int coolDown;




void MakeProjectile(int p)
{
  projectiles[p].inUse = true;
  
   int direction = -1;
   float angle = 0.0;
   int xOffset = 0; int yOffset = 0;
   
   switch (player.Loop){
	case 0 : 
		direction = eDirectionDown; xOffset = 0; yOffset = 50; angle = 3.0*Maths.Pi/2.0; // (3/2)Pi = 270 degrees = down
		break;
	case 1 : 
		direction = eDirectionLeft; xOffset = -50; yOffset = 0; angle = 2.0*Maths.Pi; // 2Pi = 180 degrees = left
		break;	
	case 2 : 
		direction = eDirectionRight; xOffset = 50; yOffset = 0; angle = 0.0; // 0 = 0 degrees = right
		break;	
	case 3 : 
		direction = eDirectionUp; xOffset = -50; yOffset = 0; angle = Maths.Pi/2.0; // Pi/2 = 90 degrees = up
		break;	
   }
   projectiles[p].c.Visible = true;
   projectiles[p].c.Move(cego.x+xOffset, cego.y+yOffset, eNoBlock, eAnywhere);
   projectiles[p].c.FaceDirection(direction);
   projectiles[p].x = IntToFloat(projectiles[p].c.x);
   projectiles[p].y = IntToFloat(projectiles[p].c.y);

   projectiles[p].age = 0;
}


//Update projectiles location at each screen refresh
void MoveProjectiles()
{

  for (int p=0; p<MAX_PROJECTILES; p++) {
	if(projectiles[p].inUse) { //in use
	  //Our accurate locations, in float
	  projectiles[p].x+=Maths.Cos(projectiles[p].angle)*PROJECTILE_SPEED;
	  projectiles[p].y+=Maths.Sin(projectiles[p].angle)*PROJECTILE_SPEED;
	  
	  //Our on-screen locations, in pixels (rounded from the float value)
	  projectiles[p].c.x = FloatToInt(projectiles[p].x);
	  projectiles[p].c.y = FloatToInt(projectiles[p].y);
	}
  }

}

//Kill projectiles that have been around for too long
void KillProjectiles()
{

  for (int p=0; p<MAX_PROJECTILES; p++) {
    if (projectiles[p].inUse) {
	  projectiles[p].age++;
	  if (projectiles[p].age > PROJECTILE_LIFESPAN) {
		  projectiles[p].inUse = false;
		  projectiles[p].c.Visible = false;
		  projectiles[p].age = 0;
	  }
	}
  }

}

void ManageShooting()
{
  if (IsKeyPressed(eKeySpace)) {
    if(coolDown==0) {
      coolDown = COOLDOWN; //reset cooldown
      //Find a projectile that's not in use
      for (int i=0; i<MAX_PROJECTILES; i++) {
        if(!projectiles[i].inUse) { //found!
		  MakeProjectile(i);
		  break; //stop looking immediately
		}
      }
    }
  }
}

void repeatedly_execute()
{
  if (coolDown > 0) 
    coolDown--;

  ManageShooting();
  MoveProjectiles();
  KillProjectiles();

}


//Bind your in-game projectiles with some actual characters from your game, that you created in the editor
void InitProjectiles()
{
  projectiles[0].c = cFire0;
  projectiles[1].c = cFire1;
  projectiles[2].c = cFire2;
  projectiles[3].c = cFire3;
  projectiles[4].c = cFire4;
  projectiles[5].c = cFire5;
}

void game_start() 
{
  SetGameSpeed(60); //600FPS is probably better than AGS' weird native 40FPS
  InitProjectiles();
}

#480
No one even mentionned Chronicles of Innsmouth, made with AGS! It was quite cool. The puzzles and graphics were a bit weak and yet the atmosphere is definitely there and the experience overall quite enjoyable. The makers managed to build a nice little world around the novel.
SMF spam blocked by CleanTalk