Learning XNA 3.0 phần 4

Bởi vì XACT sử dụng giao thức mạng để giao tiếp với các tiện ích thử giọng, bạn sẽ cần để mở khóa các cổng cho cả hai XACT và tiện ích các thử giọng. Nếu bạn theo các bước trong chương 1, các cổng này nên đã được giải toả khi bạn cài đặt XNA Game Studio . | mode in the Begin method and instead always draw the background first and then the score. Modify the Draw method of your Gamel class to look like this protected override void Draw GameTime gameTime Draw background image backgroundTexture new Rectangle 0 0 null 0 0 Draw fonts scoreFont Score currentScore new Vector2 10 10 0 1 1 gameTime Compile and run the game and you ll see the impact that a background image can have on the overall look of the game Figure 7-7 . This is getting exciting things are really starting to come together Nice job. You ve got a background and multiple types of sprites with varying behaviors. Now let s take a look at finishing up the game scoring logic. Game Scoring As you ll recall from our earlier discussion of this topic the first thing you need to do is determine what event s will trigger a change in score. For this game you ll be updating the score whenever the user successfully avoids a three-blade four-blade skull ball or plus sprite. You actually have already added the logic to determine when one of those sprites has been successfully avoided it lies in the code that deletes the sprites when they disappear off the edge of the screen. If a sprite makes it across the screen and needs to be deleted that means the user has avoided that sprite and if it was a three-blade four-blade skull ball or plus sprite you need to give some points to the user. 130 Chapter Putting It All Together Figure 7-7. The game in progress with a sprite background Any time you re developing a game scoring rules and calculations are things you ll need to think about. You ll most likely formulate an idea implement it and then tweak it while testing your game to see if it feels right and plays the way you .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.