---
# System prepended metadata

title: 網絡程式設計

---

網絡程式設計
===
[Google Drive](https://drive.google.com/drive/folders/1U8ngzuKJqIK1XyciwbF4lTJxLZu4Cy8d?usp=sharing)

# 游戲主體範例
## 手把手教你写蛇蛇大作战 with libGDX

[範例Github](https://github.com/zhangman523/SnakeIo)

[教學文章](https://www.zhangman523.cn/228.html)

[libGDX 套件](https://libgdx.badlogicgames.com/download.html) 

* 套件有放在GoogleDrive
* 測試完成檔 **lhl.rar** 有放在GoogleDrive

### 工作環境位置錯誤問題
改工作環境位置
![](https://i.imgur.com/OtdhPtF.png)

### TexturePacker/Tools錯誤
打開 build.gradle 加入以下的一段 "compile..." 的 code：
```java=
project(":desktop") {
    ...

    dependencies {
        ...
        compile "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
    }
}
```
然後Sync同步build.gradle 就ok了

# 網絡連接範例
## Java Multiplayer libgdx with AppWarp
[範例Github無連綫](https://github.com/libgdx/libgdx-demo-superjumper)
[範例Github有連綫](https://github.com/SauravGShephertz/libgdxMultiplayerSuperJumper)

[教學文章原文](https://appwarp.shephertz.com/game-development-center/java-multiplayer-libgdx-tutorial/)
[教學文章翻譯](https://developer.aliyun.com/article/112189)

* 無連接測試完成檔 **test_superjumper_SDK30.7z** 有放在GoogleDrive

### 範例 Superjumper SDK問題
下載 Android10 SDK 29.0 后重啓AndroidStudio



### setScreen() 錯誤問題
加import
```java=
import com.badlogic.gdx.Game;
```
然後把 ApplicationAdapter
```java=
public class MyGdxGame extends ApplicationAdapter {
    ...
}
```
改成 Game
```java=
public class MyGdxGame extends Game {
    ...
}
```