Well, I tried to do all the possible things to fix the trouble with
the trayectory of the board, first I configure the code sent by Mr.
Holger to use it in a 7 X 7 board, then to check the differences
between the program of Mr. Holger and adecuate them to my program
and check the typos if there are.
Anyway the pieces are still moving in a wrong way, even that I
configure the board in different ways the pieces still go straight
(what I mean with configure the board?, well, it means that I first
put the initial position in the down right square (the bigger X and
Y position on a graphic) of the board and then I put it on the up
left square (the 0 position of X and Y on the board).
But the trouble stays there, it looks like these code is getting me
some troubles.
if(this.dx==0 && this.dy==0 && this.move!=0) {
this.move-=1
oldField=this.field*1
newField=oldField*1+1
if(newField>=24){newField=0}
this.dx=gameboard[newField].cx-gameboard
[oldField].cx
this.dy=gameboard[newField].cy-gameboard
[oldField].cy
this.Field=newField
}
if (this.dx>0) {
this.dx-=2
this.currentX+=2
}
if(this.dy<0){
this.dy+=2
this.currentY-=2
}
if(this.dx<0){
this.dx+=2
this.currentX-=2
}
if(this.dy>0) {
this.dy-=2
this.currentY+=2
}
Well, this is the trouble.
By other side I am interested to modify text data on SVG using a SQL
database... is posible to do it?
Greetings and sorry for the inconveniences.
--- In [email protected], "jucabapa79"
<[EMAIL PROTECTED]> wrote:
> I repaired the board table and the pieces go straight to the left
as
> I plan but it still don't turn and go out of the game board...
>
> I will follow searching what is wrong...
>
> Greetings.
>
> --- In [email protected], "jucabapa79"
> <[EMAIL PROTECTED]> wrote:
> > Good afternoon.
> >
> > I review the code made by Mr. Holger and this is working
properly
> in
> > a 3 X 3 board, but I have troubles to make it run properly in a
6
> X
> > 6 board what I mean?
> >
> > First I made that my game pieces run in the down right corner,
but
> > when the pieces began to run using the throw button, they are
> > running first one space to the left and then one space down, and
> > they never go straight in one direction and also they go out of
> the
> > board.
> >
> > Would someone explain me what is going on? What do you suggest
to
> > correct this bug and made it run properly?
> >
> > Greetings.
> >
> > Travsam
> >
> > --- In [email protected], "jucabapa79"
> > <[EMAIL PROTECTED]> wrote:
> > > Mr. Holger, I will check the code made by you and study all
the
> > > properties, so I can adapt it to my game board, and also to
> learn
> > > more about scripting because for me it this the most difficult
> > thing
> > > in SVG.
> > >
> > > I will do my best.
> > >
> > > Travsam
> > >
> > > --- In [email protected], Holger Will
<[EMAIL PROTECTED]>
> > > wrote:
> > > > jucabapa79 schrieb:
> > > >
> > > > > Me again...
> > > > >
> > > > > As I told in some of the messages my dice will have two
> > > functions,
> > > > > the first one it was solved, but I still have troubles
with
> the
> > > > > second one.
> > > > >
> > > > > The objective is to move a piece in the sides of a square
> > board
> > > of
> > > > > 700*700 and I tried using the script down below.
> > > > >
> > > > > But any moment I try to load the SVG the javascript reader
> > gives
> > > an
> > > > > exception because is expecting an object, but all SVG is
> loaded
> > > > > properly, anyway anytime that I click on the "Throw"
button
> > gets
> > > the
> > > > > same mistake.
> > > > >
> > > > > Any suggestion?
> > > >
> > > > hi
> > > > ive written two small examples,
> > > > the first is a simple game framework. showing a simple
> gameloop.
> > > > http://www.treebuilder.de/svg/monopoly01.svg
> > > > the second is a basic monopoly framework,
> > > > http://www.treebuilder.de/svg/monopoly02.svg
> > > > study both examples, if you have any questions concerning
this
> > > code,
> > > > just ask.
> > > > cheers
> > > > Holger
> > > >
> > > > >
> > > > > Travsam
> > > > >
> > > > > <script type="text/ecmasscript">
> > > > > <![CDATA[
> > > > > /** The dice should move a piece in a board, the
> piece
> > is
> > > > > in the right down corner, the piece has first to
> > > > > move to the left, when it gets the corner will move
> up,
> > and
> > > > > so on, moving in the trayectory of the clock, the
> > > > > movement will be controled by a random number
between
> 1
> > and
> > > > > 6.
> > > > > */
> > > > >
> > > > > // svg variables
> > > > > var svgdoc;
> > > > > var svgroot;
> > > > >
> > > > > // game area variables
> > > > > var xMax = 700;
> > > > > var yMax = 700;
> > > > > var xMin = 100;
> > > > > var yMin = 100;
> > > > >
> > > > > // game variables
> > > > > var piece;
> > > > > var pieceX = 700;
> > > > > var pieceY = 700;
> > > > >
> > > > > function init (evt) {
> > > > >
> > > > > svgdoc = evt.getTarget().getOwnerDocument();
> > > > > svgroot = svgdoc.documentElement;
> > > > > piece = svgdoc.getElementbyId("piece");
> > > > >
> > > > > }
> > > > >
> > > > > // function throwDice, it will choose a number
between
> 1
> > > and
> > > > > 6 and set it as value "dice"
> > > > >
> > > > > function throwDice(){
> > > > >
> > > > > var randomDice=Math.round(Math.random()*5) + 1;
> > > > > dice = randomDice;
> > > > >
> > > > >
> > > > > }
> > > > > // function movePiece, first it will move the piece
to
> > the
> > > > > left, then it
> > > > > have to check when the piece arribes to the left
> corner
> > > then
> > > > > it moves up and so
> > > > > on, also it will use the counter "dice" that comes
> from
> > the
> > > > > throwDice function.
> > > > >
> > > > > function movePiece()
> > > > > {
> > > > >
> > > > > Do
> > > > > {
> > > > > pieceX = pieceX - 100;
> > > > > if pieceX = xMin and pieceY = yMax
> > > > > {
> > > > > pieceY = pieceY - 100;
> > > > > }
> > > > > else if pieceX = xMin AND pieceY = yMin
> > > > > {
> > > > > pieceX = pieceX + 100;
> > > > > }
> > > > > else if pieceX = xMax AND pieceY = yMin
> > > > > {
> > > > > pieceY = pieceY + 100;
> > > > > }
> > > > > Dice = Dice-1;
> > > > > piece.setAttribute("cx",pieceX);
> > > > > piece.setAttribute("cy",pieceY);
> > > > > }
> > > > > While Dice > 0;
> > > > >
> > > > > }
> > > > >
> > > > >
> > > > > // ]]>
> > > > >
> > > > > </script>
> > > > >
-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my
membership"
----
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/