TopDown的2D游戏,遇到两个问题,第一问题是游戏一开始就会从tilemap上掉下去。第二个问题是没法和图层2上的物体做碰撞。

一、碰撞问题
1、创建的TileSet后,左侧选中一个tile后,一定要点击上边的Add Box,否则创建出来的这个块没有碰撞

2、在编辑TileMap的时候,一定要选择上图自己添加AddBox的tile。然后图层1上创建有障碍物的图层,要勾选Override Collision Thickness,这样图层2才会有一定的厚度,这样就可以碰撞了。

3、按Ctrl+c可以查看碰撞体,可以方便测试了。

4.另外也是微调Capsule Component的大小,才能比较好碰撞。

可以选择Coliding Tiles查看已经设置的碰撞体,非常方便

二、打包时总是有jar下载不下来
修改
C:\Program Files\Epic Games\UE_5.1\Engine\Build\Android\Java\gradle\build.gradle文件
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven{url 'https://maven.aliyun.com/repository/jcenter'}
maven{url 'https://maven.aliyun.com/repository/google'}
// google()
// mavenCentral()
// jcenter()
}
dependencies {
classpath project.hasProperty('ANDROID_TOOLS_BUILD_GRADLE_VERSION') ? project.property('ANDROID_TOOLS_BUILD_GRADLE_VERSION') : 'com.android.tools.build:gradle:3.5.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
apply from: 'buildscriptAdditions.gradle', to: buildscript
}
apply from: 'baseBuildAdditions.gradle'
allprojects {
repositories {
maven{url 'https://maven.aliyun.com/repository/jcenter'}
maven{url 'https://maven.aliyun.com/repository/google'}
// google()
// mavenCentral()
// jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}