日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷(xiāo)解決方案
cocos如何新建python模板

在Cocos Creator中新建Python模板的步驟如下:

1、打開(kāi)Cocos Creator編輯器。

2、點(diǎn)擊菜單欄的"文件",然后選擇"新建"。

3、在彈出的對(duì)話框中,選擇"Python腳本"作為模板類(lèi)型。

4、輸入模板的名稱(chēng)和路徑,然后點(diǎn)擊"創(chuàng)建"按鈕。

接下來(lái),你可以在新建的Python模板中編寫(xiě)代碼,以下是一個(gè)簡(jiǎn)單的示例:

import cocos
from cocos.director import Director
from cocos.scene import Scene
from cocos.layer import Layer
from cocos.sprite import Sprite
class MyScene(Scene):
    def __init__(self):
        super(MyScene, self).__init__()
        self.add_child(MyLayer())
class MyLayer(Layer):
    def __init__(self):
        super(MyLayer, self).__init__()
        self.sprite = Sprite('res/hello.png')
        self.add_child(self.sprite)
        self.sprite.position = (320, 240)
if __name__ == '__main__':
    director = Director()
    scene = MyScene()
    director.run(scene)

這個(gè)示例中,我們創(chuàng)建了一個(gè)簡(jiǎn)單的場(chǎng)景,包含一個(gè)圖層和一個(gè)精靈,精靈顯示了一張名為"hello.png"的圖片,并將其放置在屏幕中央。


分享題目:cocos如何新建python模板
文章起源:http://www.dlmjj.cn/article/dhoiphd.html