sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    You Decide Competition!

    Scheduled Pinned Locked Moved SketchyPhysics
    51 Posts 8 Posters 4.5k Views 8 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C Offline
      CPhillips
      last edited by

      @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 Reply Last reply Reply Quote 0
      • P Offline
        Physicsguy1
        last edited by

        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 Reply Last reply Reply Quote 0
        • P Offline
          Physicsguy1
          last edited by

          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 Reply Last reply Reply Quote 0
          • H Offline
            hobbnob
            last edited by

            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 Reply Last reply Reply Quote 0
            • C Offline
              CPhillips
              last edited by

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

              1 Reply Last reply Reply Quote 0
              • B Offline
                BTM
                last edited by

                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 Reply Last reply Reply Quote 0
                • M Offline
                  MrPlanet
                  last edited by

                  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 Reply Last reply Reply Quote 0
                  • B Offline
                    BTM
                    last edited by

                    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 Reply Last reply Reply Quote 0
                    • W Offline
                      Wacov
                      last edited by

                      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 Reply Last reply Reply Quote 0
                      • W Offline
                        Wacov
                        last edited by

                        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 Reply Last reply Reply Quote 0
                        • B Offline
                          BTM
                          last edited by

                          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 Reply Last reply Reply Quote 0
                          • C Offline
                            CPhillips
                            last edited by

                            @wacov said:

                            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)

                            The code looks like this:

                            
                                    for ent in $curEvalGroup.definition.entities
                                        if ent.definition.name == name+("%02d"%frame)
                                            ent.hidden = false
                                        else
                                            ent.hidden = true
                                        end
                                    end
                            
                            

                            First is this:

                            $curEvalGroup.definition.entities
                            

                            Without going into details, this amounts to a list of every group inside the hero characters group.

                            for ent in $curEvalGroup.definition.entities
                            
                            

                            This means set to be for every entity (groups in this case) inside the character set variable "ent" to be
                            that group and then...

                            if ent.definition.name == name+("%02d"%frame)
                            

                            If the "ent" has a certain name then hide or unhide.

                            ent.hidden=true 
                            
                            

                            Remember "ent" is a Sketchup group and this is how you hide a group using Ruby.

                            A simpler example:

                            
                            if(frame==100)
                               $curEvalGroup.hidden=true
                            elsif(frame==200)
                               $curEvalGroup.hidden=false
                            end
                            
                            

                            This will hide the object at frame 100 and show it again at frame 200

                            1 Reply Last reply Reply Quote 0
                            • W Offline
                              Wacov
                              last edited by

                              Okay... that will be useful, but now I'm wondering how you changed the evaluation group to something outside the group it was written in πŸ˜„

                              Is that what the first part of the script is for?

                              Also, is it possible to change the default SU material of an object using script? Like when you paint a group, any surfaces within with the default paint will change.

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

                              1 Reply Last reply Reply Quote 0
                              • B Offline
                                BTM
                                last edited by

                                You can do that through styles, or when using the paint bucket on a default coloured face, hold shift.

                                1 Reply Last reply Reply Quote 0
                                • W Offline
                                  Wacov
                                  last edited by

                                  No, it has to be through script. There must be a way, because plugins are able to change the material...

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

                                  1 Reply Last reply Reply Quote 0
                                  • C Offline
                                    CPhillips
                                    last edited by

                                    @wacov said:

                                    Okay... that will be useful, but now I'm wondering how you changed the evaluation group to something outside the group it was written in πŸ˜„

                                    Is that what the first part of the script is for?

                                    Also, is it possible to change the default SU material of an object using script? Like when you paint a group, any surfaces within with the default paint will change.

                                    I dont know what you mean. I didnt exactly change the evaluation group. "$curEvalGroup" is the group that the code is running on.

                                    You know how you can make one object in SU and make it a component then copy it. Now when you edit one all of them change. That is because there is one object "definition" and 0 or more "instances" of that object. Every group is actually a instance.

                                    $curEvalGroup.definition.entities
                                    

                                    Given an instance ($curEvalGroup) get its definition and then get the entities in that definition.

                                    The first part of the script just gets the x,y,z location of the body.

                                    BTW "$" means global varible in Ruby. You can use the $curEvalGroup but do not and I mean do not try to make new ones. You could mess things up pretty easy.

                                    1 Reply Last reply Reply Quote 0
                                    • H Offline
                                      hobbnob
                                      last edited by

                                      physicsguy you didnt' tell me your challenge decision. i'm using the default option that i decided on a few weeks ago in case of such an event. in future all group decisions for the sp challenges are banned.

                                      My WIP Thread:Here

                                      1 Reply Last reply Reply Quote 0
                                      • B Offline
                                        BTM
                                        last edited by

                                        ...Just pick whatever one was voted for the most on the other thread. I'd say that would be the best solution.

                                        1 Reply Last reply Reply Quote 0
                                        • H Offline
                                          hobbnob
                                          last edited by

                                          he'd created loads of polls and voting places dotted around, theres no way i'm goign through all of that, i might as well tell you now, the next challenge will be for a motorcycle.

                                          My WIP Thread:Here

                                          1 Reply Last reply Reply Quote 0
                                          • B Offline
                                            BTM
                                            last edited by

                                            😐 That's pretty basic and simple...
                                            ... I'd still go for animated character. I'd already started, thinking it was the probable topic, as it seems to be on the top of the forum poll, and the only other poll I could find is one on the warehouse; but that wouldn't change it still.

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 3
                                            • 3 / 3
                                            • First post
                                              Last post
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement