superpowers教程系列-第二部分: Actors和Components

In the?previous?tutorial we installed the Superpowers game engine and created our first game. In this tutorial we are going to get comfortable with the editor and create our first scene. First let’s start with the editor, which we should have loaded at the conclusion of the last part. In the top left corner, there is a control for managing assets. Click the + page icon and select scene:


Then in the resulting dialog:


Now you should see your newly created scene in the list on the left hand side of the application:


By default (or by double left clicking the scene if not), your newly created scene should appear in the editor view in the middle of the screen:


Given that it’s currently empty, you just get a black screen. For this example we are going to work in 2D, so switch to 2D mode:


Now that we have a scene created and loaded, we have new options on the right hand side of the screen. Think of it this way... the left hand side of the screen holds the assets that go together to make your game. The right hand side holds the contents of each particular scene. Switching between scenes will change the contents available on the right, but the assets on the left are available across your entire game. Here is the right hand window for scene graph management:


Superpowers follows the common practice of being a component based game engine. That means that the elements of your world are composed of various components and there is some kind of object that holds these components. In Superpowers the component container is called an actor, and every object draw in the scene is ultimately an Actor. Let’s add one to the scene now, click the Star with a + icon, pictured above. You will then get a popup asking you to name your actor:


This Actor is going to be the camera, so name it accordingly. Call it either Camera or Stephen, whichever makes more sense to you. Personally, I went with camera. Once created, you can see that all actors by default have a Transform component automatically attached.


You can also now see and position our actor in the scene view:


However, for now it’s just a manipulator widget, as there is no visible component attached to this actor. You can use this widget for changing the position of the object within the scene, with each coloured arrow corresponding to a particular axis of movement, or by using the gray box in the center to move freely. We will come back to this widget later, for now we need to make our camera a camera.

To create a camera, we simply add a Camera component to our newly created actor. Down below the controls for controlling the actor’s position there is a button New Component:


Click it.

Now select Camera as the Component type:


You should now see a new editor for our newly added component:


Since we doing a 2D game, set the Mode to Orthographic, which means that images will remain the same size regardless to their depth within the scene.

We now have a camera, and a scene. Stay tuned for the next part where we will finally draw something on that screen!

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市耘沼,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌澳盐,老刑警劉巖,帶你破解...
    沈念sama閱讀 221,273評論 6 515
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件蜗顽,死亡現(xiàn)場離奇詭異飞几,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)本股,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 94,349評論 3 398
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來桐腌,“玉大人拄显,你說我怎么就攤上這事“刚荆” “怎么了躬审?”我有些...
    開封第一講書人閱讀 167,709評論 0 360
  • 文/不壞的土叔 我叫張陵,是天一觀的道長。 經(jīng)常有香客問我承边,道長遭殉,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 59,520評論 1 296
  • 正文 為了忘掉前任博助,我火速辦了婚禮险污,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘富岳。我一直安慰自己蛔糯,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 68,515評論 6 397
  • 文/花漫 我一把揭開白布城瞎。 她就那樣靜靜地躺著渤闷,像睡著了一般疾瓮。 火紅的嫁衣襯著肌膚如雪脖镀。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 52,158評論 1 308
  • 那天狼电,我揣著相機(jī)與錄音蜒灰,去河邊找鬼。 笑死肩碟,一個(gè)胖子當(dāng)著我的面吹牛强窖,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播削祈,決...
    沈念sama閱讀 40,755評論 3 421
  • 文/蒼蘭香墨 我猛地睜開眼翅溺,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了髓抑?” 一聲冷哼從身側(cè)響起咙崎,我...
    開封第一講書人閱讀 39,660評論 0 276
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎吨拍,沒想到半個(gè)月后褪猛,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 46,203評論 1 319
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡羹饰,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,287評論 3 340
  • 正文 我和宋清朗相戀三年伊滋,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片队秩。...
    茶點(diǎn)故事閱讀 40,427評論 1 352
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡笑旺,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出馍资,到底是詐尸還是另有隱情燥撞,我是刑警寧澤,帶...
    沈念sama閱讀 36,122評論 5 349
  • 正文 年R本政府宣布,位于F島的核電站物舒,受9級特大地震影響色洞,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜冠胯,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,801評論 3 333
  • 文/蒙蒙 一火诸、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧荠察,春花似錦置蜀、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,272評論 0 23
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至焕盟,卻和暖如春秋秤,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背脚翘。 一陣腳步聲響...
    開封第一講書人閱讀 33,393評論 1 272
  • 我被黑心中介騙來泰國打工灼卢, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人来农。 一個(gè)月前我還...
    沈念sama閱讀 48,808評論 3 376
  • 正文 我出身青樓鞋真,卻偏偏與公主長得像,于是被迫代替她去往敵國和親沃于。 傳聞我的和親對象是個(gè)殘疾皇子涩咖,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,440評論 2 359

推薦閱讀更多精彩內(nèi)容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi閱讀 7,345評論 0 10
  • 如果說到我最愛的食物,腐乳是肯定少不了的繁莹,是佐餐下飯絕佳的選擇檩互。腐乳又叫豆腐乳,在長株潭一帶叫法比較有意思蒋困,叫“貓...
    Nesier無恙閱讀 1,430評論 11 49
  • 起早床盾似,顧名思義。不要睡懶覺雪标,早一點(diǎn)起床零院。什么時(shí)候起床,可以算是早起呢村刨?百度上告抄,各執(zhí)己見。我認(rèn)為嵌牺,6點(diǎn)—7點(diǎn)之間起...
    綠芒果君閱讀 772評論 1 0
  • 期末考試結(jié)束 回到家里 萬念俱灰 畫了這個(gè) 感覺像是一個(gè)人被吞噬了打洼,融化了龄糊,滴落下來 很久之前的創(chuàng)作 表情不夠痛苦...
    kencaca閱讀 289評論 0 2