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.

DarkBASIC Discussion / User drawn objects

Author
Message
Pixelator
17
Years of Service
User Offline
Joined: 8th Jul 2007
Location: here
Posted: 19th Jul 2008 01:02 Edited at: 20th Jul 2008 21:33
Hey, i was messing around with some paper and a pencil drawing little cities, and an idea hit me. Why not make it into a game. have the user draw out cities with the mouse, making each building by hand . This means that each building will have a unique shape, and the user will define what type of a building it will be.

i quickly (in excitement) put together some code to test out the actual drawing of buildings and labeling system and im getting a few glitches.



glitch # 1:
i can only draw 1 building and then it quits

glitch # 2:
it isn't labeling the building type, but i cant figure out why.

another problem that isn't exactly a glitch is that if you move the mouse too quickly, the pixels get chopped up. i realize that that is because the mouse is moving too quickly for the computer to realize it. i know this could be solved by making a line in between the pixels but im not quite sure how it would be implemented

How to use:

To draw press left mouse button down.
When done, add to the left mouse button the right mouse button (without releasing the left one)
press h to make it a house, or r for road.
when done labeling, you can go ahead and release the mouse buttons.

[edit] come on guys! no body knows???

i changed the program to put a dot where he center was and it was way wrong so im going to wrestle with finding a differend way to get midx and midy.

[edit 2]

heres my equasions:

midx = ((xmax-xmin)/2)+xmin
midy = ((ymax-ymin)/2)+ymin

Pixelator
17
Years of Service
User Offline
Joined: 8th Jul 2007
Location: here
Posted: 21st Jul 2008 18:47
[bump]

Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 22nd Jul 2008 00:19
One problem you have a typo in the code at the bottom:



should be



Also an error :

should be


Though I'm not quite sure why that line is in there at all.

quick mouse continuous line:



Work on it a little bit more. It's hard to tell what you are going for.

Enjoy your day.
Pixelator
17
Years of Service
User Offline
Joined: 8th Jul 2007
Location: here
Posted: 23rd Jul 2008 01:16 Edited at: 23rd Jul 2008 05:36
ok, thanks, that helped quite a bit.

ill explain a little bit more.

the user draws and object, whitch the computer otomatically finds the center of. the the use labels it, and the computer prints the label at the center.

[edit]
ok, ive completely rewritten the code, but for now i left out the labeling bit.

Problem : for some reason the computer is misreading there the lowest x and y values are.

controlls: click to draw. when done, you can release the left mouse button and when you are ready click the right mouse button to place dot on center



Pixelator
17
Years of Service
User Offline
Joined: 8th Jul 2007
Location: here
Posted: 23rd Jul 2008 05:33 Edited at: 23rd Jul 2008 05:36
[double post]

Irojo
17
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 24th Jul 2008 00:20
I can't seem to figure out while it's doing that... But it appears you wanted to make a line, so I fixed it to do that. Sorry if this is wasting your time. :/






I urge you to watch the film "Who killed the electric car". Support electric cars! Did you know their used to be more electric cars then gassoline cars?
Pixelator
17
Years of Service
User Offline
Joined: 8th Jul 2007
Location: here
Posted: 24th Jul 2008 00:29 Edited at: 24th Jul 2008 00:41
no prob, just a mistake of placement!

[edit]

It works!!!!!! i just changed
to


for some reason putting them on 2 lines instead of 4 confuzed the computer! Happy!

entire code*


*please don't use in and product sold commercially or in the black market. if you do, give me 90% of the profit.

Irojo
17
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 24th Jul 2008 01:42 Edited at: 24th Jul 2008 01:42
AHHHHHH I've used that before *hits head* I don't know how I could have missed it!
What the
if something then if something

is doing,
if something
if something
endif
endif

I should have known! Congratulations.


Keep my posted on how the work goes.

I urge you to watch the film "Who killed the electric car". Support electric cars! Did you know their used to be more electric cars then gassoline cars?
Pixelator
17
Years of Service
User Offline
Joined: 8th Jul 2007
Location: here
Posted: 24th Jul 2008 18:41 Edited at: 24th Jul 2008 19:03
right now im working on the labeling and storage of labels. ive run into a little problem though.
i use
to make a menu just below the object drawn to select type of building.earliear i use the command
to load the image, but when the computer gets to the sprite command, it gives me an error that says that the image doesn't exist. i tried using 2 instead of 1 but that didn't help.

entire code


[edit]

ok i figured out what was wrong, the computer was highlighting the sprite command, but it ment the set current bitmap command. very odd, as i have never had to create a bitmap before i use set current bitmap before. i thought that it just switched it to a seperate screen. and also, it was putting the sprite on bitmap 0 because sprites can only work on screen, so i should just use paste image like so!!!!:


in addition, i added :



Now for a problem. when you click one of the buttons,it thinks you have already started on the next building, so when you do start building, it puts the middle in between the building and the button.

Irojo
17
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 24th Jul 2008 19:27
I don't quite understand what your saying. If you post the code, I might be able to help.

I urge you to watch the film "Who killed the electric car". Support electric cars! Did you know their used to be more electric cars then gassoline cars?
Pixelator
17
Years of Service
User Offline
Joined: 8th Jul 2007
Location: here
Posted: 25th Jul 2008 01:00 Edited at: 25th Jul 2008 04:36
srry, i was in a hurry. entire code:


screenie of wat im sayin below


oh, and how can i get the menu to go away?


[edit] fixed.!!! i made the menue into sprite and made a few other small changes to make it wait in apropriate spots and its working flawlessly.

almost.

all code:


when i try to make a commercial building it doesn't print the label. im not sure if the problem is in the menu or in the labeler.

Irojo
17
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 25th Jul 2008 01:18 Edited at: 25th Jul 2008 01:22
instead of paste image, use sprite
then
you can either
delete sprite
or hide sprite
to get rid of it.
Then of course if you want it back and you used the command 'hide sprite' you use the command 'show sprite'


[EDIT]
I don't get how you got your extra dot problem, but I think this answers your question.

Go to another loop until the player selects the object, then return like so
do
if object_make=1 then gosub sub_loop
sync
loop

sub_loop:
do
if label_select=1 then return
sync
loop

I urge you to watch the film "Who killed the electric car". Support electric cars! Did you know their used to be more electric cars then gassoline cars?
Irojo
17
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 25th Jul 2008 01:27 Edited at: 25th Jul 2008 01:28
I have to go, but I think this is exactly what your looking for. use the command sprite to place it. I will make it later if you haven't.




I urge you to watch the film "Who killed the electric car". Support electric cars! Did you know their used to be more electric cars then gassoline cars?
Pixelator
17
Years of Service
User Offline
Joined: 8th Jul 2007
Location: here
Posted: 25th Jul 2008 20:34
make the label a sprite??? i am confuzed. did you see my edit?

Irojo
17
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 25th Jul 2008 21:28
Now I did. I posted that before your edit.

I urge you to watch the film "Who killed the electric car". Support electric cars! Did you know their used to be more electric cars then gassoline cars?
Pixelator
17
Years of Service
User Offline
Joined: 8th Jul 2007
Location: here
Posted: 2nd Aug 2008 23:20
im going to start on final game. ill keep ya posted

Irojo
17
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 3rd Aug 2008 02:58
Alright. I can't wait.

My internet is not fast enough to double post.

Login to post a reply

Server time is: 2025-06-07 06:34:09
Your offset time is: 2025-06-07 06:34:09