sketchucation logo sketchucation
    • 登入
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🔌 Smart Spline | Fluid way to handle splines for furniture design and complex structures. Download

    You Decide Competition!

    已排程 已置頂 已鎖定 已移動 SketchyPhysics
    51 貼文 8 Posters 5.6k 瀏覽 8 Watching
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • P 離線
      Physicsguy1
      最後由 編輯

      Anyway, I have a sprite that does work, but doesn't do anything other than run, run in place, and run backwards. use a joystick. A is jump. Feel free to edit it and post it on the warehouse, because this model was intended to be a building set for my contest. If you wanted to know the contest ends on the first of june.


      mariocrud.skp

      1 條回覆 最後回覆 回覆 引用 0
      • C 離線
        CPhillips
        最後由 編輯

        push([(0.5-rightx)*1,-(0.5-righty)*1,0])
        This is the equivalent of a thruster. It says push the hero in the X and Y direction based on rightx and rightz but no thrust in the Z (up direction)

        setVar("lastpos",getposition) if(frame==0)
        If this is the first frame store the hero's current position for use later.

        h=getVar("lastpos")-getposition
        set the temp value "h" to be the how much the hero has moved this frame.
        If he moved 10 in X and 20 in Y the value of h would be [10,20,0]

        h.z=0
        if the player moved in the Z direction remove it from the speed calculation.
        this way the player doesnt play the run animation when falling. only when moving in
        X and Y

        speed=h.length
        find out how fast the hero was moving. if h is [10,0,0] then then speed becomes 10.

        setVar("lastpos",getposition)
        save the new position so it can be used to calc speed for next frame.

        setVar("heroheading",h)
        save the direction the hero is moving for use elsewhere to make him face in
        the direction of movement.

        "speed" is just a temporary variable. getposition returns a "Vector3d" so that is what "h" is. And if you have a Vector you can find out how long it is by saying "h.length"

        #create a new vector object
        h=Geom;;Vector3d.new(10,0,0)
        #how long is the vector
        h.length
        
        
        1 條回覆 最後回覆 回覆 引用 0
        • P 離線
          Physicsguy1
          最後由 編輯

          I get it now. BTW the UI won't allow the code to be entered. I am guessing that my version isn't configured to run code like that. When will the next version of SP be released?

          1 條回覆 最後回覆 回覆 引用 0
          • C 離線
            CPhillips
            最後由 編輯

            Post the code that is failing and I can tell you why.

            Next will maybe be this weekend. But it wont be all that different. It turns out SP conflicts with another plugin and I need to fix that.

            I think I have figured out the direction to take with the scripting. But it is going to take a while to actually do it.

            1 條回覆 最後回覆 回覆 引用 0
            • M 離線
              MrPlanet
              最後由 編輯

              @unknownuser said:

              Note: posted, not made.
              [attachment=0:29d1zqy3]<!-- ia0 -->Canyon4.jpg<!-- ia0 -->[/attachment:29d1zqy3]

              MAN, is that seriously your car? GREAT CAR! 😄

              I reject your reality and substitute my own.

              1 條回覆 最後回覆 回覆 引用 0
              • M 離線
                MrPlanet
                最後由 編輯

                ~Anyway, i've made a mario type game with SP2, used physical gears and ran too slow.

                I reject your reality and substitute my own.

                1 條回覆 最後回覆 回覆 引用 0
                • P 離線
                  Physicsguy1
                  最後由 編輯

                  Sounds Nice. I have one on my computer that features a full level will all the secret piping and a mushroom that gives health. It's only 600KB, so i might build a whole 10-level game out of it. For Chris: testsetAnimation('anim',frame/30%10) won't work. tried using it alone without any movements, it was just intended to be just a plain animation.

                  1 條回覆 最後回覆 回覆 引用 0
                  • B 離線
                    BTM
                    最後由 編輯

                    I managed to make a walking robot that swings it's arms when walking, but the punch button will still work perfectly anyways, even if it's walking.
                    You never realize how complex it is until it's near-completion...
                    It will still walk fine without the ball & motor, but it enables it to walk backwards, and a bit faster: it also works as a shock absorber.

                    These pictures are from a slightly earlier version, I've now added the ability to shoot a lazer out of it's eye 😎

                    1 條回覆 最後回覆 回覆 引用 0
                    • C 離線
                      CPhillips
                      最後由 編輯

                      Wow! Sounds cool. Look forward to seeing it.

                      1 條回覆 最後回覆 回覆 引用 0
                      • C 離線
                        CPhillips
                        最後由 編輯

                        @unknownuser said:

                        Anyway, I have a sprite that does work, but doesn't do anything other than run, run in place, and run backwards. use a joystick. A is jump. Feel free to edit it and post it on the warehouse, because this model was intended to be a building set for my contest. If you wanted to know the contest ends on the first of june.

                        Nice start.

                        1 條回覆 最後回覆 回覆 引用 0
                        • P 離線
                          Physicsguy1
                          最後由 編輯

                          I tried setting it to stand in place and jump without running, but i had trails of emitted objects that i don't want. I don't exactly get it. could you help me with it? try moving the white box while running. Some extra trails will appear, but i can't get rid of them.


                          mariosprite.skp

                          1 條回覆 最後回覆 回覆 引用 0
                          • P 離線
                            Physicsguy1
                            最後由 編輯

                            I think it has something to do with other emitters. Look at this file. In the beginning, there is a [?] box. hit it, and grab the mushroom that appears. you will have a trail of objects following you. The mushroom was actually an emitter emitting the image. There also is another way to get the trails. Go down the pipe at the beginning of the level, and walk through the purple box and find your way up to the machine gun. press "B" when you are near the machine gun to fire. I'm not sure what is going on, but i can tell that it is linked to other emitters.


                            rpg.skp

                            1 條回覆 最後回覆 回覆 引用 0
                            • H 離線
                              hobbnob
                              最後由 編輯

                              it's saturday, and physicsguy hasn't reached a conclusion. you need to do so quickly or i will have to decide myself. next time, choose the subject on your own to avoid these things

                              My WIP Thread:Here

                              1 條回覆 最後回覆 回覆 引用 0
                              • C 離線
                                CPhillips
                                最後由 編輯

                                Nice model Physicsguy! Clever use of 3d to make a 2d game.

                                1 條回覆 最後回覆 回覆 引用 0
                                • B 離線
                                  BTM
                                  最後由 編輯

                                  I've been trying to make a code that sets a variable to 1 when a key is pressed, but after __ frames will set it back to 0, whether the key is pressed or not. It's just not working so far though 😒.

                                  ... Anyone got any ideas?

                                  1 條回覆 最後回覆 回覆 引用 0
                                  • M 離線
                                    MrPlanet
                                    最後由 編輯

                                    Wacov made one for me, its not exactly what you want but....

                                    if getVar("two")==0;
                                    
                                    setVar("repeat",1);
                                    setVar("time",0);
                                    	
                                    elsif getVar("repeat")==1;
                                    
                                    setVar("time",frame+350);
                                    setVar("repeat",0);
                                    
                                    end;
                                    
                                    
                                    if frame>getVar("time") && getVar("time")>300;
                                    
                                    #What you want goes here
                                    ;
                                    
                                    end
                                    

                                    I reject your reality and substitute my own.

                                    1 條回覆 最後回覆 回覆 引用 0
                                    • B 離線
                                      BTM
                                      最後由 編輯

                                      D'oh! ( In a Hommer Simpson voice)

                                      I forgot you could use 'frame' 😆 I was trying to do it all using onTick, which wasn't working out too well 😉

                                      ...Now I have a slightly newer problem. Since 'frame' is a dynamic variable, and changes constantly, the script I've been trying to get working won't work.

                                      if key("space")==1 then setVar("timer",frame+10);else setVar("timer",0);end;
                                      
                                      if frame>=getVar("timer") and key("space")==1 then setVar("go",1);else setVar("go",0);end;
                                      

                                      ... Basically, I need to find a way to get the frame from when key("space") is first pressed. 😕

                                      UPDATE: I found a work-around, it doesn't work exactly as expected, but I think it's better 😆
                                      ... Just wait 'till I'm done 😉

                                      1 條回覆 最後回覆 回覆 引用 0
                                      • W 離線
                                        Wacov
                                        最後由 編輯

                                        You guys are finally catching up with the scripting! 😆 BTM, I look forward to seeing your game.

                                        Oh, and, off topic, I just thought of a way to make a controllable oscillator. Should be ready soon!

                                        http://sketchup.google.com/3dwarehouse/cldetails?mid=3096a836877fb9af6cd8ad826e9017b8&prevstart=0

                                        1 條回覆 最後回覆 回覆 引用 0
                                        • W 離線
                                          Wacov
                                          最後由 編輯

                                          Chris, how are you managing to hide and unhide components using script? There are parts of the script you made that I understand, and parts I don't, but it seems the crucial thing is the 'ent.hidden'. The 'ent' is a variable, but I can't find the point where it was created, nor where it was assigned to any specific item. So, how can I assign variables to components? (With the purpose of hiding/unhiding them on command)

                                          http://sketchup.google.com/3dwarehouse/cldetails?mid=3096a836877fb9af6cd8ad826e9017b8&prevstart=0

                                          1 條回覆 最後回覆 回覆 引用 0
                                          • B 離線
                                            BTM
                                            最後由 編輯

                                            That must be some of the sketchup ruby API scripting he used. You can find at the sketchup website. Here's another example of using the sketchup API:

                                            if slider("foo")>=0.7 then UI.messagebox ('why do that!?');else slider("foo");end;
                                            -NOTE: be prepared to have to force quit/ quit sketchup if you use that code. 😆

                                            1 條回覆 最後回覆 回覆 引用 0
                                            • 1
                                            • 2
                                            • 3
                                            • 2 / 3
                                            • 第一個貼文
                                              最後的貼文
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement