Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2 3
  ignore  |  Print  
  Wavy lines in java?  (Read 5820 times)
0 Members and 1 Guest are viewing this topic.
Offline wreed12345

JGO Knight


Medals: 24
Projects: 2
Exp: 2 years


http://linebylinecoding.blogspot.com/


« Posted 2012-12-15 00:10:20 »

I wanted to make some snow flakes falling like in this example:
http://scratch.mit.edu/projects/zombie_penguin/72596

but i wasnt sure what kind of equations the lines would use, or if they even are equations. any ideas?

Offline theagentd
« Reply #1 - Posted 2012-12-15 00:32:58 »

sin(x)?

Myomyomyo.
Offline ra4king

JGO Kernel


Medals: 342
Projects: 2
Exp: 5 years


I'm the King!


« Reply #2 - Posted 2012-12-15 00:37:36 »

Also they seem to move left and right randomly.....so.....just play around with the Random object? Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline wreed12345

JGO Knight


Medals: 24
Projects: 2
Exp: 2 years


http://linebylinecoding.blogspot.com/


« Reply #3 - Posted 2012-12-15 00:46:06 »

What does sin(x) do, do you have any examples? and i dont need them do be random i just want them to go in curved lines

Offline ra4king

JGO Kernel


Medals: 342
Projects: 2
Exp: 5 years


I'm the King!


« Reply #4 - Posted 2012-12-15 00:46:41 »

Ah you don't know trigonometry? Well that's gonna be a slight problem. :S

Offline wreed12345

JGO Knight


Medals: 24
Projects: 2
Exp: 2 years


http://linebylinecoding.blogspot.com/


« Reply #5 - Posted 2012-12-15 00:52:37 »

nope sorry Sad

Offline wreed12345

JGO Knight


Medals: 24
Projects: 2
Exp: 2 years


http://linebylinecoding.blogspot.com/


« Reply #6 - Posted 2012-12-15 01:36:31 »

ok so i figured out what sin(x) does but that makes the waves go horizontal, but i need them to be vertical.. any ideas how???

Offline theagentd
« Reply #7 - Posted 2012-12-15 01:39:08 »

ok so i figured out what sin(x) does but that makes the waves go horizontal, but i need them to be vertical.. any ideas how???
I think you might have some slight problems creating a game if you can't figure that out yourself... No offence. persecutioncomplex

Myomyomyo.
Offline HeroesGraveDev

JGO Kernel


Medals: 239
Projects: 11
Exp: 2 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #8 - Posted 2012-12-15 01:39:10 »

x = sin(y)


And yeah, learn maths.

Offline wreed12345

JGO Knight


Medals: 24
Projects: 2
Exp: 2 years


http://linebylinecoding.blogspot.com/


« Reply #9 - Posted 2012-12-15 05:14:18 »

I know im a real newb with this stuff but could someone make an example? or some pseudo code?

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online Jimmt
« League of Dukes »

JGO Kernel


Medals: 128
Projects: 4
Exp: 3 years



« Reply #10 - Posted 2012-12-15 05:17:25 »

Dude it's like 2 lines of code, literally
If you can't solve small problems like this without giant amounts of help from others then you shouldn't be making games.
Offline ra4king

JGO Kernel


Medals: 342
Projects: 2
Exp: 5 years


I'm the King!


« Reply #11 - Posted 2012-12-15 05:19:00 »

Dude it's like 2 lines of code, literally
If you can't solve small problems like this without giant amounts of help from others then you shouldn't be making games.
Not "shouldn't make games" but should learn more before starting to make games.

Offline Agro
« Reply #12 - Posted 2012-12-15 05:19:10 »

Something as simple as a wavy line? o.O Its not even as complicated as sin(x). You can just generate a random number from -1 to 1 and add that to the position, or something like that. But that wouldn't be that smooth, so you could use a variation of the "wandering" method. But I think that's too much for you. o.O

Offline Joshua Waring

Senior Member


Medals: 4
Projects: 2



« Reply #13 - Posted 2012-12-15 05:19:56 »

Dude it's like 2 lines of code, literally
If you can't solve small problems like this without giant amounts of help from others then you shouldn't be making games.
Not "shouldn't make games" but should learn more before starting to make games.
What's what I was going to say, no-one is incapable of making a game, you just have to learn.

The world is big, so learn it in small bytes.
Offline wreed12345

JGO Knight


Medals: 24
Projects: 2
Exp: 2 years


http://linebylinecoding.blogspot.com/


« Reply #14 - Posted 2012-12-15 05:21:07 »

guys im sorry for being a newb but im only in middle school lmao

Offline Agro
« Reply #15 - Posted 2012-12-15 05:22:13 »

So am I Cheesy

Offline wreed12345

JGO Knight


Medals: 24
Projects: 2
Exp: 2 years


http://linebylinecoding.blogspot.com/


« Reply #16 - Posted 2012-12-15 05:23:34 »

well i really could use some help... so instead of making fun of my lack of these skills could someone help me out?

Offline ra4king

JGO Kernel


Medals: 342
Projects: 2
Exp: 5 years


I'm the King!


« Reply #17 - Posted 2012-12-15 05:23:41 »

guys im sorry for being a newb but im only in middle school lmao
Then I suggest you not to jump into game making so quickly. Fully learn Java and code design before jumping into this area. Especially if you don't know trig :S

However, I shall help this one time:
1  
int value = Math.sin(theta); //keep incrementing theta by any number below Math.PI/4 (play around the numbers for best effect)

The value returned is between -1 and 1. Just add this to the center of the wave path.

Offline Agro
« Reply #18 - Posted 2012-12-15 05:24:55 »

Yeah, trig is going to help you with euclidean distance, 3d cameras, direction vectors, noise functions, and practically anything,

Offline Sammidysam
« Reply #19 - Posted 2012-12-15 05:25:23 »

So am I Cheesy

Me too Cheesy

I don't know trigonometry either.  If I need it somewhere I have friends who could help.
Offline wreed12345

JGO Knight


Medals: 24
Projects: 2
Exp: 2 years


http://linebylinecoding.blogspot.com/


« Reply #20 - Posted 2012-12-15 05:26:49 »

But im only trying to make a simple 2d effect here lol nothing 3d yet! im not nearly ready for that

Offline Sammidysam
« Reply #21 - Posted 2012-12-15 05:28:09 »

But im only trying to make a simple 2d effect here lol nothing 3d yet! im not nearly ready for that

Where did he say his code related to 3d?
Offline ra4king

JGO Kernel


Medals: 342
Projects: 2
Exp: 5 years


I'm the King!


« Reply #22 - Posted 2012-12-15 05:28:32 »

But im only trying to make a simple 2d effect here lol nothing 3d yet! im not nearly ready for that

Where did he say his code related to 3d?
He mentioned 3D cameras Wink

Online Jimmt
« League of Dukes »

JGO Kernel


Medals: 128
Projects: 4
Exp: 3 years



« Reply #23 - Posted 2012-12-15 05:28:55 »

well i really could use some help... so instead of making fun of my lack of these skills could someone help me out?
We are not making fun of your lack of skill...simply advising that you try to solve problems before asking us to solve them for you. Being in middle school is not an excuse, rather it is a privilege to start game programming so young.
Offline wreed12345

JGO Knight


Medals: 24
Projects: 2
Exp: 2 years


http://linebylinecoding.blogspot.com/


« Reply #24 - Posted 2012-12-15 05:30:07 »

I did try and solve this problem...but with my research and no knowledge of trig I had no clue you could do this

Offline wreed12345

JGO Knight


Medals: 24
Projects: 2
Exp: 2 years


http://linebylinecoding.blogspot.com/


« Reply #25 - Posted 2012-12-15 05:31:14 »

Thank you very much! i truly appreciate the help.. I must soon learn all the trig in the world!

Offline Joshua Waring

Senior Member


Medals: 4
Projects: 2



« Reply #26 - Posted 2012-12-15 05:33:44 »

Personally I believe it's best to start young, it allows the brain to adapt and grow in a way, specialise at a deeper level.
It's also nice for trying to get a job "programming since 12"  Grin

you can also use graph.tk to see how your equations will look.

The world is big, so learn it in small bytes.
Offline ra4king

JGO Kernel


Medals: 342
Projects: 2
Exp: 5 years


I'm the King!


« Reply #27 - Posted 2012-12-15 05:49:25 »

Thank you very much! i truly appreciate the help.. I must soon learn all the trig in the world!
I'm assuming you saw my edit with the code and explanation?

In anyway, I understand your frustration. You just want to get things done without painstakingly reading through lots of explanations. You want to get things done[tm]. However, that's not the right way to learn things and use them properly in the future. Hopefully you get a small glimpse of what you can do with sin(theta) and hopefully you keep learning more maths because math is just awesome Cheesy

Offline Best Username Ever

Junior Member





« Reply #28 - Posted 2012-12-15 06:03:02 »

Kids these days. Back when I learned to program we didn't have internets.


Dude it's like 2 lines of code, literally
If you can't solve small problems like this without giant amounts of help from others then you shouldn't be making games.
Not "shouldn't make games" but should learn more before starting to make games.

Or, failing that, join StackOverflow. Wink


hopefully you keep learning more maths because math is just awesome Cheesy

Yes
Offline ra4king

JGO Kernel


Medals: 342
Projects: 2
Exp: 5 years


I'm the King!


« Reply #29 - Posted 2012-12-15 06:58:37 »

Ok masteryoom. It's time to talk. With all due respect, please refrain from using all these oversized texts and obnoxious colors.

Let's act like adults here, please. We can get silly sometimes, but properly and at the right time.

Note: this is not meant to be offensive. I am simply tired of seeing you post with HUGE font random comments that add nothing to the conversation. Let's maintain a high signal to noise ratio on these boards.

Pages: [1] 2 3
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CogWheelz (18 views)
2014-07-30 21:08:39

Riven (25 views)
2014-07-29 18:09:19

Riven (15 views)
2014-07-29 18:08:52

Dwinin (13 views)
2014-07-29 10:59:34

E.R. Fleming (33 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (43 views)
2014-07-24 01:59:36

Riven (43 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

List of Learning Resources
by SilverTiger
2014-07-31 18:26:06

List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!