dev.gamez.lv Forum Index dev.gamez.lv
Latvian Game Developers Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups 

Problema ar Tile dzini un kameru
Goto page Previous  1, 2, 3, 4  Next
 
dev.gamez.lv Forum Index -> Iesācējiem
View previous topic :: View next topic  
Author Message
WhiteFalcon



Joined: 16 May 2010
Posts: 102
Location: Rīga

PostPosted: Thu Jun 10, 2010 10:22 pm    Post subject:

Sākumā ta ir Zero. pēctam tiek pielagota auto pozicijai

Code:
   cam.KamerasPozicija.X = Pozicija.X;
            cam.KamerasPozicija.Y = Pozicija.Y;


un auto pozicijas pozicija vel ir atkariga no šī
Pozicija += Atrums;
//Tad vēl seko lerums auto kodu
Back to top
View user's profile
snake5
Indago dalībnieks
Indago dalībnieks


Joined: 27 Jun 2007
Posts: 2590

PostPosted: Thu Jun 10, 2010 10:51 pm    Post subject:

Noapaļot vajag kameras pozīciju. "round" funkcija.
_________________
"There are two choices here: "looks good" and "realism"." -- Paul Nettle
Back to top
View user's profile Visit poster's website
WhiteFalcon



Joined: 16 May 2010
Posts: 102
Location: Rīga

PostPosted: Thu Jun 10, 2010 11:17 pm    Post subject:

sanak

Code:
cam.KamerasPozicija += (int)Math.Round(Kas te jaraksta);
Back to top
View user's profile
snake5
Indago dalībnieks
Indago dalībnieks


Joined: 27 Jun 2007
Posts: 2590

PostPosted: Thu Jun 10, 2010 11:25 pm    Post subject:

kameras pozīcija = round( kameras pozīcija )
neko dižu nevajag..
_________________
"There are two choices here: "looks good" and "realism"." -- Paul Nettle
Back to top
View user's profile Visit poster's website
WhiteFalcon



Joined: 16 May 2010
Posts: 102
Location: Rīga

PostPosted: Thu Jun 10, 2010 11:35 pm    Post subject:

Ar to nepietiek Confused Ar to tas dižums beidzas.

Error nummur:1 -The best overloaded method match for'System.Math.Round(decimal)' has some invalid arguments

Error nummur:2 - Error 11 Argument '1': cannot convert from 'Microsoft.Xna.Framework.Vector2' to 'decimal'
Back to top
View user's profile
elvman
Indago Uzvarētājs
Indago Uzvarētājs


Joined: 09 Apr 2003
Posts: 1278
Location: Kuldiga

PostPosted: Thu Jun 10, 2010 11:51 pm    Post subject:

Math.Round spēj apaļot tikai skaitli.
Tev būtu jāraksta kas līdzīgs šim:
Code:
kameras pozīcija.x = Math.Round( kameras pozīcija.x );
kameras pozīcija.y = Math.Round( kameras pozīcija.y );
 

_________________
long time; /* know C */
Back to top
View user's profile Visit poster's website
WhiteFalcon



Joined: 16 May 2010
Posts: 102
Location: Rīga

PostPosted: Thu Jun 10, 2010 11:56 pm    Post subject:

jap.bet tas tomēr nelidz.

Code:
  cam.KamerasPozicija.X = Pozicija.X;
            cam.KamerasPozicija.Y = Pozicija.Y;
            cam.KamerasPozicija.X = Math.Round(KamerasPozicija.X);
            cam.KamerasPozicija.Y = Math.Round(KamerasPozicija.Y);


Error 10 Cannot implicitly convert type 'double' to 'float'. An explicit conversion exists (are you missing a cast?)
Back to top
View user's profile
elvman
Indago Uzvarētājs
Indago Uzvarētājs


Joined: 09 Apr 2003
Posts: 1278
Location: Kuldiga

PostPosted: Fri Jun 11, 2010 12:13 am    Post subject:

Nu tad pieliec castu - (float)
_________________
long time; /* know C */
Back to top
View user's profile Visit poster's website
WhiteFalcon



Joined: 16 May 2010
Posts: 102
Location: Rīga

PostPosted: Fri Jun 11, 2010 11:34 am    Post subject:

jam izskatas ka viss butu labi tikai ir 1 problema.Auto nekustas
Code:
      cam.KamerasPozicija.X = Pozicija.X;<-Auto pozicija
            cam.KamerasPozicija.Y = Pozicija.Y;
            cam.KamerasPozicija.X = (float)Math.Round(KamerasPozicija.X);
            cam.KamerasPozicija.Y = (float)Math.Round(KamerasPozicija.Y);
Back to top
View user's profile
bubu
Indago Uzvarētājs
Indago Uzvarētājs


Joined: 23 Mar 2004
Posts: 3223
Location: Riga

PostPosted: Fri Jun 11, 2010 12:23 pm    Post subject:

Kā auto ir jākustas? Rādi kodu.
Back to top
View user's profile Send e-mail
EDDY



Joined: 07 Oct 2005
Posts: 1610
Location: Dzimtā zeme, Latvija

PostPosted: Fri Jun 11, 2010 12:26 pm    Post subject:

Protams, ka auto nekustēsies, ja kamerai būs tāds pats ātrums kā auto. Rolling Eyes
_________________
Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday
Back to top
View user's profile
bubu
Indago Uzvarētājs
Indago Uzvarētājs


Joined: 23 Mar 2004
Posts: 3223
Location: Riga

PostPosted: Fri Jun 11, 2010 12:38 pm    Post subject:

EDDY: viņam kamera nozīmē to, ka tā ir centrēta uz auto. Un kamerai kustoties līdzi auto tiek panākts, ka tā kustās pa visu pasauli.
Back to top
View user's profile Send e-mail
WhiteFalcon



Joined: 16 May 2010
Posts: 102
Location: Rīga

PostPosted: Fri Jun 11, 2010 8:41 pm    Post subject:

Šo kodu bubu?

Code:
private void AutoAkseleracija()
        {
            Atrums += new Vector2(
                (float)(Math.Cos(Rotacija - MathHelper.PiOver2) * 0.04f),
                (float)((Math.Sin(Rotacija - MathHelper.PiOver2) * 0.04f)));

            if (Atrums.X > 10.0f)
            {
                Atrums = new Vector2(4.0f, Atrums.Y);
            }
            if (Atrums.X < -10.0f)
            {
                Atrums = new Vector2(-4.0f, Atrums.Y);
            }
            if (Atrums.Y > 10.0f)
            {
                Atrums = new Vector2(Atrums.X, 10.0f);
            }
            if (Atrums.Y < -10.0f)
            {
                Atrums = new Vector2(Atrums.X, 10.0f);
            }
        }
Back to top
View user's profile
bubu
Indago Uzvarētājs
Indago Uzvarētājs


Joined: 23 Mar 2004
Posts: 3223
Location: Riga

PostPosted: Fri Jun 11, 2010 10:19 pm    Post subject:

Tā ir ātruma maiņa. Kā tu pozīciju maini?
Back to top
View user's profile Send e-mail
WhiteFalcon



Joined: 16 May 2010
Posts: 102
Location: Rīga

PostPosted: Fri Jun 11, 2010 10:23 pm    Post subject:

Vienkārši tā ari mainu
Pozicija +=Atrums;
Back to top
View user's profile
Display posts from previous:   
dev.gamez.lv Forum Index -> Iesācējiem All times are GMT + 2 Hours
Goto page Previous  1, 2, 3, 4  Next
Page 2 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group