更改skspritenode的图像() [英] Changing image of a skspritenode()

查看:146
本文介绍了更改skspritenode的图像()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这就是我添加播放器纹理/图像的方式:

This is how I add my player's texture/image:

Player = SKSpriteNode(imageNamed:"player8")

如何在不添加或删除spritenodes的情况下更改播放器纹理/图像?

How do I change the players texture/image without adding or deleting spritenodes?

推荐答案

您指定了另一个 texture

player = SKSpriteNode(imageNamed:"player8")

稍后某个时间:

player.texture = SKTexture(imageNamed:"player123")

提示:使用大写字符开始变量,属性和方法名称是不好的样式,因为它使它们看起来像是类。

Hint: it is bad style to begin variable, property and method names with an uppercase character as it makes them appear to be classes.

这篇关于更改skspritenode的图像()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆