Basic Motion and Transitions
基本運動和轉換

One of the most powerful things about the Corona SDK is that any display object can be animated. This is a testament to the flexible graphics model that Corona offers.
其中最強大的東西有關Corona SDK的是,任何顯示對象可以是動畫。這是一個證明了靈活的圖形模型,Corona 優惠。
Animations allow you to create visually-rich and engaging user experiences. Animations are accomplished by generating a sequence of frames that evolve smoothly from frame to frame. The term tween (short for inbetween) is a term describing the process in which such intermediate frames are generated. It is often used as shorthand to indicate that a property of an object will change during the animation, as in tweening the position.
動畫讓你創建視覺效果豐富,引人入勝的用戶體驗。動畫過程是通過產生一個序列平滑演進的幀幀與幀。這個詞之間(簡稱插圖中)是一個術語描述的過程中產生這些中間幀。它經常被用來作為縮寫,表示一個對象的屬性將改變在動畫,如在補間的立場。
Transitions 轉換
The transition library allows you to easily create animations with only a single line of code by allowing you to tween one or more properties of a display object. For example, you can fadeout a display object by tweening its alpha property (the alpha property transitions from 1.0 to 0).
轉換庫允許您輕鬆地創建動畫,只有一行的代碼,讓您一個或多個屬性之間的顯示對象。例如,您可以淡出顯示其α補間對象屬性(從 1.0 alpha屬性轉換為 0)。
The simplest way to do this is to use the transition.to method which takes a display object as its first argument and a table containing the control parameters as its second. The control parameters specify the duration of the animation, an optional delay for when to start the animation, and the final values of properties for the display object. The intermediate values for a property are determined by an easing function that is also specified as a control parameter. By default this is a linear function.
最簡單的方式做,這是使用方法,需要一個 transition.to顯示對象作為它的第一個參數,一個包含了控制參數作為其第二個。控制參數指定的期限動畫,可選延遲何時開始動畫,最終值屬性的顯示對象。中間值的屬性是由一個緩和功能,也被指定為控制參數。默認情況下這是一個線性函數。
Below are some examples of how to animate a square (see Transition2 in the sample code):
下面是一些例子如何動畫一個正方形(見 Transition2在示例代碼):
 

createps 發表在 痞客邦 留言(0) 人氣()




Bitmap Mask
Corona's Bitmap Mask feature allows you to use an image as a
bitmap and apply it to other display objects. Corona converts the image
internally to grayscale; black values are then masked, while white values are
not. A mask has it own transform that can be tweened. Its properties are
accessible via the display object being masked.
 
A bitmap mask can be applied to other display objects, but certain objects
cannot be masked. These include text display objects and native display
objects.

Bitmap Mask
Corona's 的位圖掩碼功能可讓您使用圖像作為位圖,並將其應用於其它顯示對象。Corona 內部的圖像轉換為灰度,黑色,然後蒙面而白色的價值觀都沒有。一個口罩有它自己的轉換,可以補間其特性都可以通過顯示對象屏蔽。
一個位圖掩碼可以應用於其它顯示對象,但某些對象不能被屏蔽。這些措施包括文本顯示對象和本地顯示對象。

createps 發表在 痞客邦 留言(0) 人氣()


Working with Display Objects and the Stage


Creating Display Objects
You don't actually create these objects directly. Instead,
you create special kinds of DisplayObjects such as rectangles,
circles, images, text, groups, etc.

createps 發表在 痞客邦 留言(0) 人氣()

Corona Images, Shapes, and Text About Display Objects Part4
Text
display.newText( [parentGroup,] string, x, y, font, size ) creates a text object with its top-left
corner at (x, y). The local origin is at the center of the text; the reference
point is initialized to this local origin. By default, there is no text
color.

createps 發表在 痞客邦 留言(0) 人氣()

Dim RndNum As New Random() '最好在程式一開始就設定好

RndNum.Next() '產生大於等於0,小於2,147,483,647之亂數
RndNum.Next(10) '產生大於等於0,小於10之亂數
RndNum.Next(10, 20) '產生大於等於10,小於20之亂數
RndNum.NextDouble() '產生大於或等於 0.0,且小於 1.0雙精度浮點數
RndNum.NextBytes(bytes) '以亂數填入指定位元組陣列的元素

createps 發表在 痞客邦 留言(0) 人氣()

Images
Bitmap
image objects are a type of DisplayObject.

createps 發表在 痞客邦 留言(0) 人氣()

Corona Images, Shapes, and Text About Display Objects Part2
Common Object Methods
通用對象的方法
Object
methods are accessed via the colon operator. For example, if we have a DisplayObject represented by the
variable object, we can translate the object 10 pixels to the right (of it's
current position): object:translate( 100 ).

createps 發表在 痞客邦 留言(0) 人氣()



Corona Images, Shapes, and Text About Display Objects Part1
About Display Objects
All
drawing that occurs on the screen is accomplished by creating DisplayObjects. Anything that appears
on the screen is an instance of a DisplayObject. You don’t actually
create these objects directly. Instead, you create special kinds of DisplayObject such as rectangles, circles, images, text,
etc.

createps 發表在 痞客邦 留言(0) 人氣()

串接字串
s1="a"
s2="b"
s3 = s1 .. s2
print("s3:",s3 )  --印出 s3  ab

createps 發表在 痞客邦 留言(0) 人氣()

Corona:
assert(條件,"訊息")
local v=1
assert (v~=1,"error message"), 如果v是1,就印出訊息
//===========================================

createps 發表在 痞客邦 留言(0) 人氣()



Apple Corona Basic Functions Changes to Lua
Functions Removed
For
security reasons, you cannot dynamically load raw Lua code. Consequently, the
following standard Lua functions are not available in Corona:

createps 發表在 痞客邦 留言(0) 人氣()

 

First Steps
Every platform game has its star character
who the player controls. Our star is
Lerpz.
 
第一步驟
每個平台的遊戲人物都有其明星誰是播放器控制。我們的明星是Lerpz。
 
Animating
Lerpz
In this chapter we will look at:
• Implementing third-­person player
and camera controls
• Controlling and blending animations
• Using particle
systems to implement the jet-­pack’s thrusters
• Adding a blob-­shadow to the
player
• Maintaining the player’s state
• Handling player health, death
and re-­birth.
Before we can begin, we need to know what this game is all
about.
In short, we need...
 
動畫
Lerpz
在這一章中,我們將著眼於:
•實施第三人稱播放器和相機控制
•控制和混合動畫
•使用粒子系統來實現的噴氣包的推進器
•添加一個
BLOB-陰影的球員
•維護球員的狀態
•處理球員健康,死亡和再-
出生。
在我們開始之前,我們需要知道這個遊戲是怎麼一回事。
總之,我們要...
 
The Plot
Our hero is
Lerpz: an alien visiting Robot World Version 2.
This replaced Robot World
Version 1, which suffered a particularly brutal segmentation fault and abruptly
crashed into its sun many years
ago.
情節
我們的英雄是Lerpz:一個外國人來訪的機器人世界第2版。
這就取代機器人世界版本1,遭受一種特別殘酷的分割故障和其Sun突然撞向很多年前。
 

Unfortunately, Lerpz has had some bad luck: his spaceship has been impounded
by the corrupt local police.
After looking high and low, Lerpz has found his
spaceship, but Every platform game has its star character who the player
controls.
Our star is Lerpz. how can he get it back from Mr. Big’s nastier,
obsessive-­compulsive cousin, Mr. Even Bigger?
 

不幸的是,Lerpz已取得了一些壞運氣:他的飛船已被扣押了腐敗的地方警察。
看後高與低,Lerpz找到了自己的太空船,但每個平台的遊戲都有它的明星人物誰是播放器控制。
我們的明星是Lerpz。他怎麼能找回來大先生的厲害,強迫表弟先生更大?
 

Mr. Bigger loves nothing more than artistically arranging fuel canisters on
his floating patio. He particularly admires how they glow when he places them on
hover pads. (And, of course, they’re cheaper than fitting normal garden
lights.)
更大的愛先生無非藝術在他的安排燃料罐浮天井。他特別欽佩他們如何煥發他們的地方時,他就懸停墊。
(當然,他們價格比正常裝修花園燈。)
 
But there’s something Mr. Bigger hasn’t realized!
Thanks to his penny-­pinching ways, Lerpz knows that if he collects all the fuel
canisters, the power used to keep them hovering will overload the security
system. This will shut down the impound lot’s fence and free Lerpz’s spaceship.
Lerpz can then enter his spaceship, add the fuel from the cans and fly away to
freedom.
但還有一些尚未實現更大先生!由於他的小氣方式,Lerpz知道,如果他收集所有的燃料罐,電源使用,使他們徘徊將超載的安全系統。這將關閉扣押了很多的圍欄和自由Lerpz的飛船。
Lerpz可以進入他的飛船,從添加燃料罐和自由飛走。
 
All our hero has to do is collect enough fuel
canisters and the impound’s force field will automatically shut down. Lerpz can
then get back into his space car and drive it away. Mr. Bigger’s hired robot
guards will try to stop  erpz, but luckily, they’re not particularly
bright.
我們所有的英雄所要做的就是收集足夠的燃料罐和扣押的力場將自動關閉。
Lerpz然後可以重新回到他的太空車,駕駛它了。先生更大的僱用警衛機器人將試圖阻止erpz,但幸運的是,他們並不是特別明亮。
 
Now that
that’s out of the way, we can start fleshing out our
hero.
現在,這出的方式,我們可以開始充實我們的英雄。
Introducing Lerpz
*Open the project up
and view the Scenes-­>TheGame Scene. Our first step is to add Lerpz to our
Scene:
*Open the Objects folder in the Project Pane;
*Drag the Lerpz
Prefab into either the Scene View or the Hierarchy View;
*Click on the new
Lerpz entry in the Hierarchy and rename it to Player;
*Keep the Player object
selected, move the mouse over the Scene View and tap the F (focus) key to center
the view on the Lerpz model.
*Move Lerpz onto the raised platform with the
Jump Pad (the niche with the yellow chevrons), near the Jail. (See the
screenshot on the next page.)
 
介紹 Lerpz
*打開和查看項目的場面->
TheGame場景。我們的第一個步驟是將 Lerpz加入到我們的場景:
*打開對象文件夾窗格中的項目;
*拖動 Lerpz
Prefab進入無論是現場查看或層次觀;
*點擊進入新Lerpz層次結構中的重命名為播放器;
*保持Player對象選擇,移動鼠標,使景色查看和自來水的F(重點)鍵的中心查看有關
Lerpz模型。
*移動 Lerpz上所提出的平台與跳躍墊(黃色的利基與箭頭),附近的監獄。 (見截圖在下頁。)
 
If you click
Play now, you should see Lerpz standing in the courtyard outside the jail.
At
this stage, Lerpz cannot be moved and the camera also needs to be linked to our
player's
character.
 
如果您單擊播放現在,你應該看到Lerpz站在院子外的監獄。
在這個階段,Lerpz不能移動,相機也需要與我們的球員的性格。

createps 發表在 痞客邦 留言(0) 人氣()

Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。