4. Load 2D Image [psd & script]

Chapters

            4.6 How to create psd sprite ?

                        4.6.1 Open Photoshop (Tested on CC)

                        4.6.2 New (Ctrl+N) -> choose resolution and enter

Limitation:

A.) Look in Layers panel (Maybe in right hand) !!! MUST DELETE BACKGROUND LAYER BEFORE!!!

B.) Doesn't support vector shapes and layer style directly, must rasterizing save before.

                        4.6.3 Create sprite if you want, Save to .psd and load in program ( loading code see section 4.4)

            4.7 Layer

                        4.7.1 ARSA Framework compatible with Photoshop layer.

                        4.7.2 Layer name must uniqueness.

                        4.7.3 Opacity can set 0 - 100%

                        4.7.4 Sprite supported (invisible area)

            4.8 Script

Script must write after layer name e.g. Layer name is boss, click in layer and rename it by double click or menu Layer -> Rename Layer...

                        4.8.1 Transformation script, Pivot, Rotation and Scale

                          A.) Pivot, value start at top left of layer position, user can check in Photoshop layer info.

<layername> f=flags

flags:

c = center

l = left

r = right

t = top

b = bottom

h =  horizontal flip

v = vertical flip

d = default is l|t

every flags can or bit e.g.

boss f=r|b|h

                          B.) Rotation

<layername> r=0x0x0 rs=speed

r= rotation axis x y z, value is int 0 mean static, > 0 mean dynamic

rs= rotation speed, value is float speed is more value then sprite is spin fast

Rotation must available both r and rs in same time. e.g.

boss r=0x1x0 rs = 50

                          C.) Scale

<layername> sc=1x1

sc= scale in x and y, value is float, 1 mean normal, > 1 mean large, < 1 mean small

range of scale 0.01 to 2.

!!!Scale can't be 0!!! e.g.

boss sc=0.5x1.5

                        D.) HUD script

<layername> hud

hud (lower case) is script tell ARSA Framework for draw HUD.

HUD is Head Up Display if set sprite draw on the top always. e.g.

lifebar hud

                        4.8.3 Reference script

           Use often when artist create map as tile or artist need reuse sprite benefit of them is reduce memory allocation.

NOTE: Try google search 2d tile map for additional information.

<layername> aref=<layer_ref_name>

aref= rederence, value is string,  <layer_ref_name> is original layer name.

Original layer name have not space.

e.g.

boss2 aref=boss

                        4.8.4 Animate script

            User can create animation sprite in Photoshop by following script.

                                    A.) New layer and set start script.

{

                                    B.) Create image or layer after that. Create frame sprite as normal procedure.

                                    C.) New layer abd set end script.

} name=<your_name> fps=speed loop=loop_flags play

1.) name=<your_name> value is string, name of animation

2.) fps= animation speed, value is float if value more animation is fast, 0 is freeze

3.) loop=[loop flags] values are: true= loop all the time, once = do 1 time, pp = pingpong playing animate, default is true and flag can orbit.

4.) play if specify this keyword animation will automatic playing after loaded psd.

                                    D.) e.g. animate script

{

boss003

boss002

boss001

} name=boss fps=30 loop=true|pp play

NOTICE:

      Easy and clean manage layer, User can group all animation layers to single group.

                        4.8.5 Configuration script

            New layer and rename to below script

screensize(W,H)

screensize= force draw sprite to custom screen resolution W = width, H = height

ARSA Framework will draw .psd on any device by force to that screen resolution, benefit for universal app. value is int.

Example:

  screensize(960,640)

 

maxsize(X,Y,W,H)

maxsize is a command specify min/max boundary size when scroll sprite. X, Y is min, W,H is max size. value is int.

Example:

  maxsize(0,0,960,640)

 

 

setoffset(X,Y)

offset is a command start all sprite offset in this psd file. value is int.

Example:

  setoffset(0,0)

Tags: