Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / level editor

Author
Message
Blobby 101
18
Years of Service
User Offline
Joined: 17th Jun 2006
Location: England, UK
Posted: 12th Sep 2007 20:52
ok i'm making a level editor for my game, it all works how i want it to but i want to make it so that when i select another segment, the last one turns back to it's normal, single textured, state.
how would i go about doing this?



thanks to deathead for the sig!
Projects: alien abductor-5%
PresFox
19
Years of Service
User Offline
Joined: 28th Aug 2005
Location:
Posted: 13th Sep 2007 00:11
what about proper code formatting?

indenting, whitespaces, comments

Microsoft isnt evil, they just make really crappy operating systems -- Linus torvalds
dark donkey
18
Years of Service
User Offline
Joined: 4th May 2006
Location:
Posted: 13th Sep 2007 18:02
[quote]what about proper code formatting?

indenting, whitespaces, comments[center]

Yea that does help alot. But i ask a question about functions. Why do people use them instead of just putting teh comands in the loop?.
Jeff032
17
Years of Service
User Offline
Joined: 13th Aug 2007
Location:
Posted: 13th Sep 2007 19:03
Quote: "But i ask a question about functions. Why do people use them instead of just putting teh comands in the loop?"


Because...

1) It splits your code into pieces, hopefully making it easier to understand.

2) Say it takes 10 lines to calculate the LCD of two numbers, and for some reason, you are calculating the LCD of numbers several times in your program. You could...

a - Write the 10 lines of code everywhere you want to calculate the LCD (stupid)

b - Make a function, which means you only have to write the 10 lines once, and then one line whenever you want to find the LCD (smart)

Better example:
In my Space WIP, I have functions to find the first free image/object/sprite ID. Each function is about 5 lines long. I call the functions 65 times. Not using functions, that is about 325 lines. With functions it is 80 lines.

My entire space game is 1300 lines with functions. Without functions, the main loop would probably be 800-1000 lines long. With functions, its 50 lines, and the code is split into several organized files. Do you REALLY want to look at a 900 line main loop?

-Jeff

Space Game WIP
Jeff032
17
Years of Service
User Offline
Joined: 13th Aug 2007
Location:
Posted: 13th Sep 2007 19:08
Quote: "i want it to but i want to make it so that when i select another segment, the last one turns back to it's normal, single textured, state."


Between

if mouseclick()=1

and

objnum#=pick object(mousex(),mousey(),1,100)

do (psuedo code)

if objnum# doesn't equal 0, turn off blend mapping for objnum#

-Jeff

Space Game WIP

Login to post a reply

Server time is: 2024-11-26 09:36:43
Your offset time is: 2024-11-26 09:36:43