fumanshoo Posted December 28, 2012 Share Posted December 28, 2012 shouldn't this turn DebugPhysics on and off? It's essentially the same script that I have for turning emitters on and off... if KeyDown(KEY_Z)==1 then if debug==1 then DebugPhysics(1) debug = 1 else DebugPhysics(0) debug = 0 end end Quote Link to comment Share on other sites More sharing options...
macklebee Posted December 28, 2012 Share Posted December 28, 2012 are you trying to just have the debug on as long as you have the 'Z' pressed? if so then: DebugPhysics(KeyDown(KEY_Z)) if you are trying to toggle it where each key hit will leave it turned on or off then: debug = 0 --'initialize the value' while KeyHit(KEY_ESCAPE)==0 do --'Main Loop' if KeyHit(KEY_Z)==1 then debug = 1 - debug DebugPhysics(debug) end ... ... end Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
fumanshoo Posted December 28, 2012 Author Share Posted December 28, 2012 Thank you, I was trying to toggle it on and off. Would it be too much trouble if you explained why when I use the same script for pausing emitters, I can toggle on and off, but using that script for debugging does not work? This is what I used for emitters... if KeyHit(KEY_E)==1 then if play== 1 then PauseEmitter(particleBlack) PauseEmitter(particleRed) play = 0 else ResumeEmitter(particleBlack) ResumeEmitter(particleRed) play = 1 end end Quote Link to comment Share on other sites More sharing options...
macklebee Posted December 28, 2012 Share Posted December 28, 2012 you have the 'debug = 0' and the 'debug = 1' swapped... debug gets set to a 0 the first time you hit Z and it never will be set to a 1.. also even if you fix that, using 'KeyDown' instead of 'KeyHit' will cause it to constantly cycle thru the code making it turn the debug on/off. if KeyHit(KEY_Z)==1 then if debug==1 then debug = 0 else debug = 1 end DebugPhysics(debug) end 1 Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
fumanshoo Posted December 28, 2012 Author Share Posted December 28, 2012 Ah, thank you. I was having trouble understanding that. Quote Link to comment Share on other sites More sharing options...
fumanshoo Posted December 28, 2012 Author Share Posted December 28, 2012 I find it a little easier doing: --debug physics if KeyHit(KEY_Z)==1 then if debug== 1 then DebugPhysics(0) debug = 0 else DebugPhysics(1) debug = 1 end end Quote Link to comment Share on other sites More sharing options...
xtreampb Posted December 28, 2012 Share Posted December 28, 2012 try this to lessen the code Bool Debug=false; if(KeyHit(KEY_Z)) Debug!=Debug; DebugPhysics(Debug); This should set Debug to what it is not Quote bool Life() { while(death=false) { if(death==true) return death; } } I have found the secret to infinite life Did I help you out? Like my post! Link to comment Share on other sites More sharing options...
fumanshoo Posted December 28, 2012 Author Share Posted December 28, 2012 I believe this is C++. I'm using Lua because I'm an absolute noob... sorry Quote Link to comment Share on other sites More sharing options...
macklebee Posted December 28, 2012 Share Posted December 28, 2012 try this to lessen the code yes, thats the exactly what i tried to show him in post #2 for all intents and purposes as far as minimal lua code with the exception of just using 1/0 rather than true/false... but since he is new to programming in general, probably writing it out 'long-hand' at first will help him understand the logic i guess... fumanshoo, this is the lua version of just what he is doing: debug = false --'initialize the variable before main loop' --'then inside the main loop' if KeyHit(KEY_Z)==1 then debug = not debug DebugPhysics(debug) end Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
fumanshoo Posted December 28, 2012 Author Share Posted December 28, 2012 Ah thank you. I never would have known that there would be so many ways to do one task. I like it. Quote Link to comment Share on other sites More sharing options...
ChrisMAN Posted December 28, 2012 Share Posted December 28, 2012 Writing code is sort of a minigame... Most passionate coders do this. Quote Link to comment Share on other sites More sharing options...
macklebee Posted December 28, 2012 Share Posted December 28, 2012 Writing code is sort of a minigame... Most passionate coders do this. lol... i suspect that is very true... i don't even consider myself a programmer, but i spend a lot of time going back and cleaning up code for no other reason other than being very anal about having condensed/pretty code... 1 Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
fumanshoo Posted December 28, 2012 Author Share Posted December 28, 2012 i don't even consider myself a programmer, but i spend a lot of time going back and cleaning up code for no other reason other than being very anal about having condensed/pretty code It's a good thing you do what you do because I'd be pretty helpless without your help haha Quote Link to comment Share on other sites More sharing options...
xtreampb Posted December 29, 2012 Share Posted December 29, 2012 i have discovered that programming is a theory and the language we use is just the tool used to apply the theory. I like to create multiple programs, each testing individual components that go into my main application. This helps me cut out all the extra code that can clutter my logic. then go back and clean it up, then finally, copy and paste. 1 Quote bool Life() { while(death=false) { if(death==true) return death; } } I have found the secret to infinite life Did I help you out? Like my post! Link to comment Share on other sites More sharing options...
cassius Posted December 29, 2012 Share Posted December 29, 2012 A beginner needs helpfull error messages. You get that in c c++ and bmax. 1 Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
fumanshoo Posted December 29, 2012 Author Share Posted December 29, 2012 I suppose I will work in C++ for I have wanted to do that for a while. There are still things about C++ that I do not understand, but I have a few friends that program in C++, so I could always get their help... plus there are plenty of examples on Leadwerks Wiki. Quote Link to comment Share on other sites More sharing options...
ChrisMAN Posted December 29, 2012 Share Posted December 29, 2012 Error messages are nice but... I feel the exact opposite about c++ being good for beginners. C++ is nothing but syntax sugar for blocks of memory. A beginner should be able to get results while building a foundation in problem solving without having to take on the the problems of compilers, pointers, templates. I don't know why all c++ devs decided they had to abbreviate variables and template names but it is pretty stupid. Try finding beginner information on c++ iterators. The documentation styles for c++ are arcane and ineffective. Some of the new c++11 stuff really breathes fresh air into it but if you are coding in visual studio you won't see those features for a while. To make matters worse a lot of developers get stuck in structural programming languages like c++ before they learn object oriented ones, or functional styles of programming. To contrast it is a foundational language that is great for making video games. It teaches algorithmic thinking and performance. It is undergoing a bit of a renaissance and will be a fantastic environment once the right people get involved. Most importantly its rise will hearken the end of the dark ages of programming, the framework languages (.NET, Java) as c++ is becoming a viable substitute. This is coming from a bitter man who has spent way too much time trying to get mingw to work on a microsoft ecosystem and praying to the gods for binaries to drop from the sky. 1 Quote Link to comment Share on other sites More sharing options...
fumanshoo Posted December 29, 2012 Author Share Posted December 29, 2012 Don't pray to gods because from what I have learned in programming so far, you are the god. You make everything in your world how you like. Gods are more than likely wise deities, and professional programmers are the smartest people I have come across. In this case, you are just a smart god that has to make worlds out of what other gods have made before you... If that makes any sense... Quote Link to comment Share on other sites More sharing options...
cassius Posted December 29, 2012 Share Posted December 29, 2012 I would suggest using the c language, not c++.A good few people on the forum claim to be using c++ but when you look at their code its actually c. The wiki examples are mostly in c not c++. Its easy to learn and you can turn to c++ when you are ready. EDIT: I would reccomend Code::blocks with Mingw compiler for an easy aproach. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
ChrisMAN Posted December 30, 2012 Share Posted December 30, 2012 I would suggest using the c language, not c++.A good few people on the forum claim to be using c++ but when you look at their code its actually c. The wiki examples are mostly in c not c++. Its easy to learn and you can turn to c++ when you are ready. EDIT: I would reccomend Code::blocks with Mingw compiler for an easy aproach. This is good advise. If you learn c++ without learning c first you will not understand some of the stuff that is going on. Learn C the hard way is pretty tight. http://c.learncodeth...ay.org/book/ C is a lot less bull****; simple and effective. I love linus torvolds rant on c++. I hope that Josh exposes the rest of the lua bindings in the engine header file for leadwerks 3. We could see some really cool C + lua stuff. Quote Link to comment Share on other sites More sharing options...
Pixel Perfect Posted December 30, 2012 Share Posted December 30, 2012 C++ was designed to be a multi-paradigm language and contains the entire C language as a subset (with a few exceptions). It was originally named C with classes before being renamed C++. You can argue forever (as many people love to do) about the pros and cons of any language, however, C++ has stood the test of time and remains the industry standard for gaming to this day, so for any youngster wanting to enter the gaming industry it's an invaluable entry on your skill list. Simple use of C++ to code a Leadwerks based engine is not beyond most people and is relatively easy. In depth knowledge of C++ is a different matter but is generally not required by anyone other than professional programmers. However, people should not get hung up on programming languages and what or what not to use. Most fairly decent programming languages are capable of doing the job. What is much more important is being creative and inventive in your design and solutions to problems and developing good troubleshooting skills. These will get you far further towards achieving your gaming goals than the choice of any one language. It's the person using the tools that matters far more than the tools themselves, which is true of most things in life. The only exception for the beginner is ensuring you have a good IDE (Integrated Development Environment) that provides comprehensive debug capability and good error reporting. 1 Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.