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

#101
Quote from: Wretched on Thu 10/08/2006 21:42:35
In Zugzwang I used two Screens, one with Hotspots and one with Regions. I read both on a mouse click. The Hotspots gives me the Board X value and Regions the Board Y value.
I don't get what you mean by "using 2 screens"? The regions and hotspots are drawn on separate backgrounds, different rooms ?
Quote from: Wretched on Thu 10/08/2006 21:42:35

function ScreenXY(int x, int y)Ã,  Ã, //Board (x,y)Ã,  Ã,  (0,0) is top left
{
Ã,  if (y==0) SY=220;Ã,  Ã,  //Get Screen Y values for vertical centre of each square
Ã,  if (y==1) SY=195;
Ã,  if (y==2) SY=171;
Ã,  if (y==3) SY=150;
Ã,  if (y==4) SY=129;
Ã,  if (y==5) SY=110;
Ã,  if (y==6) SY=94;
Ã,  if (y==7) SY=81;

I think I understand the part where SY is initialized to eg. SY=81 (calculated based on the height of the squares on the background) but I don't get the part if(y==0) etc.
I understand that it is linked to the region or hotspot assigned in a specific row (depending on what you used for the y valuesi.e hotspot or region) but have no idea how it is linked.
Quote from: Wretched on Thu 10/08/2006 21:42:35
Ã,  ky=1.0-(IntToFloat(SY)-81.0)/(225.0-89.0);Ã,  //ky=1.0 at bottom =0.0 at top
Ã, 
Can you elaborate on what value you used for the calculations.
Quote from: Wretched on Thu 10/08/2006 21:42:35
Ã,  kx=(IntToFloat(x))/(IntToFloat(BoardSize-1));

I couldn't find anything on the BoardSize variable that was used here (was not declared)

Thanks for the help so far I appreciate the effort!
#102
Quote from: SSH on Thu 10/08/2006 12:41:55
You coudl calulate the square clicked on from the x and Y mouse co-ords, then calculate the centre of the square and move the character to that point. That would also avoid having to paint lots of hotspots, and any limit on the number of hotspots.

This is exactly the point where I get a headache. ;D
It sounds like a great idea but I wouldn't know how to go about it. It would definately solve the problem because using the mouse.x and mouse.y position on_mouse_click event will not centre the object in the adjacent block but would rather move it to the exact spot the player clicked on (I think). Can you elaborate a little on the HOW TO or even point me at something in the manual that might help?

Thanks
#103
Thanks Ishmael

Quote from: Ishmael on Thu 10/08/2006 11:35:26
If you're not experienced in scripting I suggest you go through the scripting tutorial in the manual and poke around the default game template and possibly other templates and open source projects out there to see how things are done by other people.

I know just enough about code not to hurt myself but I'm getting there.

Quote from: Ishmael on Thu 10/08/2006 11:35:26
As for the functionality of the board, you can either use on_mouse_click in the room script and check for mouse co-ordinates on click,

I could not pick up anything that would return the mouse X and Y coords on the mouse click event for input into the object.Move command.Ã, 

Quote from: Ishmael on Thu 10/08/2006 11:35:26

or paint hotspots on the grid and have them all trigger the same script function, which moves the object appropriately.

Am I mistaken in thinking that the number of hotspots are limited to much less than 64 (30 I think)?

Quote from: Ishmael on Thu 10/08/2006 11:35:26

What I can tell you, is that you most likely need a fair amount of if-statements.

The logical statements is one topic I actually understand !

Thanks again!

#104
I want to make a very basic board game where the objective is to move one object to a specifc point before it is intersected by another object.

Object 1 (only object that can be manipulated by the player) can only move one block at a time, either horizontal or vertical. Movement to be initiated by clicking (left click) on the square you want to move to.

Object 2 - once object one has made its move it must move two squares at a time and it must try to intercept object one (if object 2 catches up with object 1 the game is lost)). It must always move horizontally on its first move unless its path is blocked by something (wall) in which case object 2 will move vertically first and then try to move horizontally on the second move. If it end up on the same horizontal row as object one but its path is obstructed then it will not move any further (same applies for vertical obstruction) . If it ends up behind an obstruction and object 1 is on the same horizontal row it should not advance anywhere and object 1 will have another turn to move. This status should remain untill object 1 makes a vertical move that will trigger object 2 to move out from behind the obstruction.

I know it is a mouth full but I'm looking for the basic commands to use to get the "player" object to move to the square that it click on. (I'm not looking for someone to do it for me. I just need someone to point me in the right direction)

Grid for the game is a basic chess board (8x8 squares) of 40x40
#105
Thanks SSH!

I got it to sort of do what I want by using:
ob.Move(ob.X, ob.Y-40, 3, eBlock,eAnywhere);
ob.Move(ob.X+40, ob.Y, 3, eBlock,eAnywhere);
ob.Move(ob.X, ob.Y+40, 3, eBlock,eAnywhere);

Although this works just fine its not exactly what is was hoping to do.
I'll just have to redraw the graghics to someting that would be more suited to this type of movement.Ã, 
#106
It is exactly what I want (I think) but just for a moment assume that you are dealing with a total idiot that knows very little about coding, how would such a mentally challenged individual go about changing the z property of an object. I read in the manual that you can change the z property of a character but couldn't find the same "type" of command, which allows you to change this parameter for an object. ::)
#107
Quote from: SSH on Tue 01/08/2006 14:42:32
As for the end-locations not working, I'm not sure which bit of code that you have is supposed to be checking for this situation... can you elaborate?

I edited my post to include the code that checks if the puzzle is solved.
I managed to resolve the slider pieces going out of alignment ( if I used the code that I posted in the actual game code it would have worked the first time around but thats what you get for working on stuff till 02h00 am).

As for the second part of my problem, I still have to find a way to make the slider pieces "jump". Alynn mentioned that I can use a walkable area but as I'm already using one for the slider pieces to move on a horizontal line, how do I code it so the slider pieces will use walkable area 1 when they need to move to the adjacent empty square and walkable area 2 when they need to "jump" over an obstructing pieces?

Would it work if I changed this line of code:
ob.Move(ob.X+80, ob.Y, 3, eBlock);

to
GetWalkableAreAt(ob.X, ob.Y-40);
ob.Move(ob.X+80, ob.Y, 3, eBlock);

if I include a second walkable area above the slider pieces?
#108
I'm working on a puzzle which is pretty much the same as the slider puzzle here

I'm working on a puzzle, which is pretty, much the same as the slider puzzle here. The only difference is that the background contains only 7 horizontal blocks. There are 6 objects (7 if you include
  • which is not in use) on this grid with a blank space in the centre. The objective is to swap all the objects on the left with those on the right and vice verse. Objects can only move in one direction and can move to a blanks space adjacent to its current coordinates (x+40) or jump over an obstructing object (leapfrog x+80) providing the next blank space is open. I got the whole thing to work up to a point i.e. the pieces are moving in the right direction etc) but when an object gets to the leftmost or rightmost positions and you left click on it again it jumps out of alignment.

    Another problem that I would like to get around is the fact that when an object needs to move past an object (leapfrog) it currently slides behind the obstructing object. Is there a way that I can make it look like its jumping over this object?

    I'm using AGS 2.71

    My code:


    In the repeatedly exe
    if ( mouse.IsButtonDown(eMouseLeft)){
    Ã,  Ã,  Ã, If(button_pressed == 0){
    Ã,  Ã,  Ã,  Ã,  button_pressed=1;
    Ã,  Ã,  Ã,  Ã,  ob= Object.GetAtScreenXY(mouse.x, mouse.y);
    Ã,  Ã,  }
    }
    else {
    Ã,  Ã,  button_pressed = 0;
    Ã,  Ã,  if(ob != null) {
    Ã,  Ã,  ob.Baseline = 0;Ã,  Ã, 

    if (Object.GetAtScreenXY(ob.X + 40, ob.Y-1) == null && GetWalkableAreaAt(ob.X+40, ob.Y-1) != 0 && ob.ID <=3) {
    Ã,  Ã,  Ã,  Ã,  ob.Move(ob.X+40, ob.Y, 3, eBlock);
    Ã,  Ã,  Ã,  }
    if (Object.GetAtScreenXY(ob.X + 80, ob.Y-1) == null && GetWalkableAreaAt(ob.X+80, ob.Y-1) != 0 && ob.ID <=3) {
    Ã,  Ã,  Ã,  Ã,  ob.Move(ob.X+80, ob.Y, 3, eBlock);
    Ã,  Ã,  Ã,  }

    Ã,  Ã,  Ã,  else if (Object.GetAtScreenXY(ob.X - 40, ob.Y-1) == nullÃ,  && GetWalkableAreaAt(ob.X-40, ob.Y-1) != 0 && ob.ID>=4) {
    Ã,  Ã,  Ã,  Ã,  ob.Move(ob.X-40, ob.Y, 3, eBlock);
    Ã,  Ã,  Ã,  }
    Ã,  else if (Object.GetAtScreenXY(ob.X - 80, ob.Y-1) == nullÃ,  && GetWalkableAreaAt(ob.X-80, ob.Y-1) != 0 && ob.ID>=4) {
    Ã,  Ã,  Ã,  Ã,  ob.Move(ob.X-80, ob.Y, 3, eBlock);
    Ã,  Ã,  Ã,  }

    ob = null;
    Checksolved();
    }
    }
    }

    Any suggestions on how I can fix these issues?

    edit
    The function to check if the puzzle is solved:
    //Top of room script
    // called when the puzzle is solved:
    function CheckSolved() {
    Ã, 
       int correct;
       int i = 1;
       while (i<=6) {// Or number of slide pieces
             Hotspot *hot = Hotspot.GetAtScreenXY(object.X+20, object.Y-20); //middle of tile
             if(hot.ID==i) correct++;
             else correct = 0;
             i++;
             }
       if(correct==6) {// Or number of slide pieces
          Display("Solved");

          }


    Ã, 
    }



    int button_pressed=0;
    Object *ob;
    Ã,  Ã, 
#109
Yup! As far as I know it will be reset to Fez = 0 every time because that is what you are telling it to do.

// main global script file
Ã,  Ã, int Fez = 0;// You are assigning the zero value
Ã,  Ã,  export Fez;

Just do

int Fez;
Export Fez;

You then need to assign a value to it at the beginning of the room script (room you're using it in) and/or use Fez as a counter of sorts to change the response every time you interact with something.


Look at CHANGING VARIABLES in the tutorial. It should help you out with the rest of the code

(I assume that it is in global script because the same dialogue is used in different rooms?)


#110
I'm not sure what exactly it is you are looking for. Do you have a problem with the dialog and how it is displayed in view or changing the character view to the "TalkView loop"?

For the second question you can take a look at this thread
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=20277.msg247150#msg247150
Also take a look at SetIdleView in the manual if you are looking for a straight forward solution.
#111
Thanks for the advise.
Venus helped me with a site.
My entry is Allosaurus just above the two very helpful comments that precede your post.
#112
Quote from: Lord Nipper on Wed 11/01/2006 18:48:33
Well... you... uh... draw it... and put it here...

either link to the url or put it like this:




Do I detect a some sarcasm here?
The sprite is all done but I do not have a website where I can post it and was just trying to find out if there are any alternatives.

Thanks anyway

Edit
My contribution for the comp.

Allosaurus from the Jurassic era



#113
How do I submit a sprite for the competition?
#114
You can add a Wait() statement just before the spot where you want the victory sound to play. It will take a bit of tweaking to find the correct value but it should work.
#115
I use the same program to do my backgrounds but don't have that problem. This may be a stupid question but did you make the right selection on the palette when you started your game?

Take another look at the tutorial it should point you in the right direction.
#116
If I'm not mistaken the values 0 , 0, 0 normally returns black in drawing programs but in AGS
TintScreen(0,0,0);
will return you to the original room state so you have to play around with the parameters a little to find the right setting you want.

Edit:
:-[ Sorry. You got to it before I could fix my mess.

#117
If you use the whole document as a template for the pieces? Huh? Sorry, I'm getting confused now ...

I should have been more clear on this. I took the complete letter and cut and paste the individual pieces to different files to create the sprites. When you cut the piece away its exact shape remains on the original document as a blank space hence I could easily use this as a template for the hotspots. the idea is to have the puzzle change into the original letter on "solved"


(i.e. the sprites 'center' isn't actually on the visible part of the sprite).

Yes it is true that some of the sprites are oddly shaped and have a lot of transparent space around them and as I understand it this could cause a problem.

How would I go abot solving that without changing the sprites I.e how do I calcalute the centre?Ã,  50% of width and 50% of height

Edit:

I changed the sprites into rectangular strips (like paper from a shredding machine) and also the hotspots but still no go. Must be the code where it checks whether the puzzle is solved. I've been over it so many times but I don't see the problem (not that I know that much about scripting).
#118
Insert Wait statement

object[9].Visible=true;// Initially not visible in editor
Wait(5);

Should work if everything else is in place.
AGS needs time to think before blocking code (sound, display) unless you use free channels for sound PlaySoundEx(int sound, int channel)
#119
(the easiest way would probably be to assemble the letter in the room editor

That's exactly how I set up the hotspots and I made them the same shape as the graphic.

Let's see if I understand this correctly.
Even though the pieces of the letter are erratic in terms of shape the actual sprite that is used is rectangular in shape so the coords for the object will always be the centre of the rectangle represented by the width and height of the sprite? That means that if I used the document from which I cut the sprites as a template for setting up the hotspots it may not line up with the centre of the sprite (the actual image)? 
#120
correct=correct*(Hotspot.GetAtScreenXY(ob.X+width/2, ob.Y-height/2)==i);
You've commented this line out - I guess you realised it's where the problem is?

Yes I did so I commented it out to be able to save and exit program.

I've changed the code but the puzzle does not run the way it should. Unlike the test puzzle by Scorpiorus mine is not made up from perfect squares.Ã,  It represents fragment of a letter (different shapes and sizes). I don't know if this would have anything to do with the corresponding hotspots. Should the hotspots be identical in shape and size as the objects to work?

The move with mouse works fine but I don't get "Puzzle has just been solved"Ã,  Ã, 

SMF spam blocked by CleanTalk