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.

Author
Message
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 13th Jul 2011 18:52 Edited at: 13th Jul 2011 19:04
Thanks Diggsey!!

I might even finish this project one day...

EDIT: Mirror option works a treat! Just changed about four lines of code and I can save masses of images... I could have possibly used image kit but so far I haven't needed it and now I may not need to so thanks a bunch Diggsey!!

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 7th Aug 2011 23:06 Edited at: 7th Aug 2011 23:09
I'm having a problem with polygon Edges as shapes. This code is supposed to make me a sphere of 20 sides (think of a goldfish bowl), but it is not stopping the contents of my bowl from escaping. I've obviously missed something but I'm not sure what it is

I've used a2Line to plot the points and I have definitely craeted my bowl shape exactly where I want it.



These are the points it plots:



baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 8th Aug 2011 11:34 Edited at: 8th Aug 2011 11:35
Batvink, try changing this line :

...to this:


You were positioning the bowl at mx,my and applying an offset of the same amount.

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 8th Aug 2011 16:02
You were right, thanks!
Back to my goldfish bowl in shame

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 8th Aug 2011 16:15
It's easily done. I've had the same issue myself which is how I spotted it.

I've written some nice little routines for this like:
"bodyID=b2d_line_body(x1#,y1#,x2#,y2#)"
...and this to add a fixture to it:
"fixtureID=b2d_line_fixture(x1#,y1#,x2#,y2#,bodyID)"

I also make some small routines to convert screen coordinates to b2d and back again.

There are a lot of ways to screw things up

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 8th Aug 2011 22:27
Quote: "I also make some small routines to convert screen coordinates to b2d and back again"


Why would you do this, is it when you have offset the screen or some other quirk I haven't found yet?

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 8th Aug 2011 23:01
Yes, when you offset the screen. In "Vs" I'm offsetting and scaling as well. It took me a while to get my head around the whole thing but I have some useful code these days.

You must have had a similar problem with pile `em up? You have vertical scrolling at least.

They are fairly simple functions, just one liners really but it's hard to remember sometimes whether you took the variable away then multiplied by the scale or multiplied first? ...or was it divided by for b2d to screen or vice versa?

Maybe some simple additional commands from Diggsey could make it easier based on the current settings for world transform? Just an idea...

Login to post a reply

Server time is: 2024-04-25 06:22:39
Your offset time is: 2024-04-25 06:22:39