跳人 - 小基础知识

时间:2015-08-28 06:24:28

标签: smallbasic

Shapes_Init()
Shapes_Add()
While("True")
Shapes.Rotate(shp[3]["obj"],300) 
Shapes.Rotate(shp[4]["obj"],-300) 
Shapes.Rotate(shp[5]["obj"],90) 
Shapes.Rotate(shp[6]["obj"],90) 
Program.Delay(1000)
Shapes.Rotate(shp[3]["obj"],-300) 
Shapes.Rotate(shp[4]["obj"],300) 
Shapes.Rotate(shp[5]["obj"],180) 
Shapes.Rotate(shp[6]["obj"],180) 
Program.Delay(1000)
Shapes.Rotate(shp[3]["obj"],300) 
Shapes.Rotate(shp[4]["obj"],-300) 
Shapes.Rotate(shp[5]["obj"],90) 
Shapes.Rotate(shp[6]["obj"],90) 
endwhile

Sub Shapes_Init
  X0 = 10        ' x offset
  Y0 = 50       ' y offset

  shp[1] = "func=ell;x=60;y=-5;width=50;height=45;bc=#6A5ACD;" 
  shp[2] = "func=rect;x=40;y=42;width=100;height=150;bc=#6A5ACD;"      
  shp[3] = "func=rect;x=14;y=50;width=12;height=60;angle=35;bc=#6A5ACD;"  
  shp[4] = "func=rect;x=155;y=50;width=12;height=60;angle=-35;bc=#6A5ACD;"
  shp[5] = "func=rect;x=130;y=195;width=12;height=60;angle=180;bc=#6A5ACD;"
  shp[6] = "func=rect;x=40;y=195;width=12;height=60;angle=180;bc=#6A5ACD;"

EndSub

Sub Shapes_Add
  GraphicsWindow.Width=1200
  GraphicsWindow.Height=700
  For i = 1 To Array.GetItemCount(shp)
    GraphicsWindow.BrushColor = shp[i]["bc"]
    If shp[i]["func"] = "rect" Then
      shp[i]["obj"] = shapes.AddRectangle(shp[i]["width"], shp[i]["height"])
    ElseIf shp[i]["func"] = "ell" Then
      shp[i]["obj"] = shapes.AddEllipse(shp[i]["width"], shp[i]["height"])
    EndIf
    Shapes.Move(shp[i]["obj"], X0 + shp[i]["x"], Y0 + shp[i]["y"])
    If shp[i]["angle"] <> 0 Then
      Shapes.Rotate(shp[i]["obj"], shp[i]["angle"])
    EndIf
  EndFor
EndSub

尝试在小型基础知识中提出跳跃动画的动画。刚出现的工作正常。有没有其他更好的方法来实现这一目标。每次他跳跃时我都需要改变颜色。怎么做?

1 个答案:

答案 0 :(得分:0)

我的方法是使用Litdev扩展,可在此处找到:http://litdev.co.uk/

你可以用LDShapes.AddAnimatedImage做什么。这使得您可以添加如下精灵表:http://www.inkfood.com/wordprez/wp-content/uploads/SpriteSheet.png

以下是它的样子:https://www.youtube.com/watch?v=cqOayLccGXo&feature=youtu.be

以下是实现这一目标的代码:

LDShapes.AddAnimatedImage("C:/SpriteSheet.png","True",12,3)