Chào mừng đến với Diễn đàn lập trình - Cộng đồng lập trình.
Kết quả 1 đến 3 của 3
  1. #1

    Cách Vẽ Lưới chơi cho cờ Caro trên Windows Phone?

    Anh chị ơi,em muốn hỏi chút về vẽ lưới chơi cơ Caro trên Windows Phone với ạ? Em chỉ được 3X3 ô,mà k vẽ được hơn ? mong anh chị giúp?


    Mã:
    using System;using System.Collections.Generic;using System.Linq;using Microsoft.Xna.Framework;using Microsoft.Xna.Framework.Audio;using Microsoft.Xna.Framework.Content;using Microsoft.Xna.Framework.GamerServices;using Microsoft.Xna.Framework.Graphics;using Microsoft.Xna.Framework.Input;using Microsoft.Xna.Framework.Input.Touch;using Microsoft.Xna.Framework.Media; namespace CoCaRoXXX{    public enum CoCaRoPlayer { None, PlayerO, PlayerX }    /// <summary>    /// This is the main type for your game    /// </summary>    public class Game1 : Microsoft.Xna.Framework.Game    {        GraphicsDeviceManager graphics;        SpriteBatch spriteBatch;         Texture2D gridTexture;        Rectangle gridRectangle;        // Texture2D resetButton;       // Rectangle resetButtonPosition;         //Texture2D oPiece;       // Texture2D xPiece;        // Texture2D oWinner;       // Texture2D xWinner;       // Texture2D noWinner;       //  Texture2D oTurn;      //  Texture2D xTurn;       // bool winnable;       // CoCaRoPlayer winner;       // CoCaRoPlayer current;       //CoCaRoPlayer[,] grid;         //bool touching;        public Game1()        {            graphics = new GraphicsDeviceManager(this);            Content.RootDirectory = "Content";                                    graphics.PreferredBackBufferWidth = 480;            graphics.PreferredBackBufferHeight = 800;            // Frame rate is 30 fps by default for Windows Phone.            TargetElapsedTime = TimeSpan.FromTicks(333333);             // Extend battery life under lock.            InactiveSleepTime = TimeSpan.FromSeconds(1);        }         /// <summary>        /// Allows the game to perform any initialization it needs to before starting to run.        /// This is where it can query for any required services and load any non-graphic        /// related content.  Calling base.Initialize will enumerate through any components        /// and initialize them as well.        /// </summary>        protected override void Initialize()        {                        base.Initialize();        }         protected override void LoadContent()        {            // Create a new SpriteBatch, which can be used to draw textures.            spriteBatch = new SpriteBatch(GraphicsDevice);             gridTexture = Content.Load<Texture2D>("TicTacToe_Grid");           gridRectangle = new Rectangle(0, 0, spriteBatch.GraphicsDevice.Viewport.Width, spriteBatch.GraphicsDevice.Viewport.Height);                   }        protected override void UnloadContent()        {                    }        protected override void Update(GameTime gameTime)        {                        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)                this.Exit();             base.Update(gameTime);        }        protected override void Draw(GameTime gameTime)        {            GraphicsDevice.Clear(Color.Pink);             spriteBatch.Begin();           DrawGrid();             spriteBatch.End();             base.Draw(gameTime);        }         private void DrawGrid()        {            spriteBatch.Draw(gridTexture, gridRectangle, Color.Black);                    }             }}

  2. #2
    Ngày tham gia
    Sep 2015
    Bài viết
    0
    mình chưa làm trên XNA bao giờ nên cũng ko dám chỉ gì, mình chỉ nói cách mình làm thôi bạn xem được ko nhé: Bạn vẽ 1 file hình bàn cờ theo tỷ lệ màn hình bạn mong muốn trên photoshop hay bất cứ chương trình gì có thể vẽ, xong rồi import vào ctrình của bạn. Xác định tọa độ các ô trên hình bằng thuật toán để xử lý tiếp. Mình từng làm game caro chạy trên WP nhưng dùng silverlight, mình dùng cách này [IMG]images/smilies/biggrin.png[/IMG]

  3. #3
    Ngày tham gia
    Sep 2015
    Bài viết
    0
    M cũng thử nó rồi,, nhưng có vẻ không được ,Vì bị lỗi.

 

 

Quyền viết bài

  • Bạn Không thể gửi Chủ đề mới
  • Bạn Không thể Gửi trả lời
  • Bạn Không thể Gửi file đính kèm
  • Bạn Không thể Sửa bài viết của mình
  •