libgdx实现模拟方向键控制角色移动

本文探讨了如何在libgdx游戏开发中实现模拟方向键控制角色移动的功能,邀请读者一起交流讨论libgdx的相关技术。
摘要由CSDN通过智能技术生成

最近在研究libgdx,有一起研究的可以讨论讨论

package com.demo;

import android.os.Bundle;

import com.badlogic.gdx.backends.android.AndroidApplication;

//Libgdx的Texture与Sprite使用
public class LibgdxActivity extends AndroidApplication {
	
	public void onCreate(Bundle bundle) {
		super.onCreate(bundle);
		// 初始化游戏屏幕,并设置是否支持GLES 2.0,如果您对向下兼容没什么需要选择true即可(2.1以上),否则选择false。
//		initialize(new FirstGame(), true);
		initialize(new Box2DDemo(), true);
	}
}


 

package com.demo;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.Actor;

public class FirstActor extends Actor{

	private  Texture texture;

	@Override
	public void draw(SpriteBatch batch, float arg1) {
		batch.draw(texture, this.x, this.y); 
		
	}

	@Override
	public Actor hit(
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值