Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 650 651 [652] 653 654 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 909707 times)

Orange Wizard

  • Bay Watcher
  • mou ii yo
    • View Profile
    • S M U G
Re: if self.isCoder(): post() #Programming Thread
« Reply #9765 on: June 15, 2016, 06:39:05 am »

y firefox u do this

Spoiler (click to show/hide)


even edge can manage
"Fuck it that's enough yellow pixels for one day"
Logged
Please don't shitpost, it lowers the quality of discourse
Hard science is like a sword, and soft science is like fear. You can use both to equally powerful results, but even if your opponent disbelieve your stabs, they will still die.

TheBiggerFish

  • Bay Watcher
  • Somewhere around here.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9766 on: June 15, 2016, 02:37:36 pm »

@3man75:What does your code look like now?
Logged
Sigtext

It has been determined that Trump is an average unladen swallow travelling northbound at his maximum sustainable speed of -3 Obama-cubits per second in the middle of a class 3 hurricane.

3man75

  • Bay Watcher
  • I will fire this rocket
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9767 on: June 19, 2016, 06:35:21 pm »

@3man75:What does your code look like now?

Spoiler (click to show/hide)

It was basically done. If you ignore the do while that I set up it would take in ANY dice you would want to throw and would throw as MANY as you wanted! But then I noticed..what if someone wasn't done? What if they wanted to throw more dice? Easy set up a loop but for some reason my scanner sidesOfADice won't 'resolve to a variable'. In other words, a black error.

Everything else works now though..

Rest of the code here:
Spoiler (click to show/hide)

Also god damn do I feel like small fry around you guys. Building servers? I have to up my game..

But yeah mostly done. Once I figure this out i'm planning on setting up the gui. Thankfully I have a Java book with an entire chapter devoted to it. Yay for books!

EDIT: Anyone know how to make the code blocks bigger?

EDIT 2: Okay. Fixed so that now the code can be looked at without copying to a notebook or squinting.
« Last Edit: June 19, 2016, 06:43:21 pm by 3man75 »
Logged

Shadowlord

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9768 on: June 19, 2016, 06:49:53 pm »

Answer: Take the code blocks out of the spoiler.

Spoiler (click to show/hide)
Logged
<Dakkan> There are human laws, and then there are laws of physics. I don't bike in the city because of the second.
Dwarf Fortress Map Archive

TheBiggerFish

  • Bay Watcher
  • Somewhere around here.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9769 on: June 19, 2016, 07:37:12 pm »

@3man75:I have no clue why it's...Oh!  When you close a looping statement, all the variables declared in it go away.  So your Scanner is already dead, and honestly you probably don't need to close it anyway.
Logged
Sigtext

It has been determined that Trump is an average unladen swallow travelling northbound at his maximum sustainable speed of -3 Obama-cubits per second in the middle of a class 3 hurricane.

3man75

  • Bay Watcher
  • I will fire this rocket
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9770 on: June 19, 2016, 08:11:29 pm »

@3man75:I have no clue why it's...Oh!  When you close a looping statement, all the variables declared in it go away.  So your Scanner is already dead, and honestly you probably don't need to close it anyway.

Code: [Select]
import java.util.Scanner;

public class MainMenu {

public static void main(String[] args) {
[b]do {[/b]
System.out.println("Welcome to dice roller. Please input the number of the dice you want to roll. For example: 6 for a 6 sided dice or 50 for a 50 sided dice.");
Scanner howManySides = new Scanner (System.in);

int sidesOfADice = howManySides.nextInt();

ObjectDice gameDice = new ObjectDice (sidesOfADice); //One argument calling constructor.

sidesOfADice = howManySides.nextInt();//reusing scanner. sidesOfADice is a int holder for the scanner.

gameDice.rollMulti(sidesOfADice);


} while (sidesOfADice != 0);
howManySides.close();
}
}

Should I move the "do {" part above to not encompass the scanner?
Logged

nogoodnames

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9771 on: June 20, 2016, 12:37:32 pm »

The Windows Phone background task that I've been struggling with for almost a month now mysteriously started working. It seems that I had it in a working state for pretty much the whole time, but I had overlooked some things involved with registering it. Then when I made a test program to try and diagnose it, I encountered an entirely different problem and just assumed that it was the same one as the main program.

Very frustrating, but I'm glad it's working now. I still have no idea what is causing the problem in my test program, and maybe I never will.
Logged
Life is, in a word, volcanoes.
                        - Random human lord

chaotic skies

  • Bay Watcher
  • Vibing in anti-space
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9772 on: June 22, 2016, 09:51:19 pm »

So this isn't exactly programming, but any recommendations on where to go to college to get into programming? And possibly any degrees I might want to get? Obviously some type of math and computer science, but anything else I might want?
Logged
Don't let me start a forum game, smack me with a paper towel roll if needed

Professional Thread Necromancer

Parsely

  • Bay Watcher
    • View Profile
    • My games!
Re: if self.isCoder(): post() #Programming Thread
« Reply #9773 on: June 22, 2016, 10:40:03 pm »

So this isn't exactly programming, but any recommendations on where to go to college to get into programming? And possibly any degrees I might want to get? Obviously some type of math and computer science, but anything else I might want?
Locate your nearest college and call the advisors there. Tell them what your goals are and what is within your means and they can help you figure out which college and program is right for you. You can also google degrees and see what kinds of jobs those lead to, or go backwards and find a job that sounds cool and figure out what kind of education/experience you need for that. Do your research. Google AMA's from people who actually do the job for a living to figure out what their day is like.

If you're very determined, you don't need to go to school, but this isn't the best path for everyone. It's possible, but you need to be very passionate, a little lucky, and willing to put the time in to contribute to open-source projects and stuff.

If you haven't already, get on codecademy , pick a language, and learn the basics of coding. Make sure this is right for you before deciding that you want a career in programming.
Logged

TheBiggerFish

  • Bay Watcher
  • Somewhere around here.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9774 on: June 22, 2016, 10:56:40 pm »

@3man75:I have no clue why it's...Oh!  When you close a looping statement, all the variables declared in it go away.  So your Scanner is already dead, and honestly you probably don't need to close it anyway.

Code: [Select]
import java.util.Scanner;

public class MainMenu {

public static void main(String[] args) {
[b]do {[/b]
System.out.println("Welcome to dice roller. Please input the number of the dice you want to roll. For example: 6 for a 6 sided dice or 50 for a 50 sided dice.");
Scanner howManySides = new Scanner (System.in);

int sidesOfADice = howManySides.nextInt();

ObjectDice gameDice = new ObjectDice (sidesOfADice); //One argument calling constructor.

sidesOfADice = howManySides.nextInt();//reusing scanner. sidesOfADice is a int holder for the scanner.

gameDice.rollMulti(sidesOfADice);


} while (sidesOfADice != 0);
howManySides.close();
}
}

Should I move the "do {" part above to not encompass the scanner?
Just remove howManySides.close(), assuming you're not going to do anything else with that Scanner outside the loop.
Logged
Sigtext

It has been determined that Trump is an average unladen swallow travelling northbound at his maximum sustainable speed of -3 Obama-cubits per second in the middle of a class 3 hurricane.

Insanegame27

  • Bay Watcher
  • Now versio- I mean, age 18. Honestly not an AI.
    • View Profile
    • Steam ID
Re: if self.isCoder(): post() #Programming Thread
« Reply #9775 on: June 23, 2016, 03:25:50 am »

So there's an assessment due tomorrow, in actionscript. I'm doing a kind of TD game, but without paths, the enemies spawn on the edges and go straight for the HQ. Right now though, the enemies spawn the whole stage width when I've specified them to only spawn on the first 400 pixels of width. The infantry continuously miss the HQ and no guns nor money system work. It's very unfinished and I wished I'd started it sooner. There may be comments which don't make sense, because it's a upgun of a previous assessment.


https://mega.nz/#!ZEZVQBbY!IU2ya2KFoQMUK1CGdZYCCGIqFh0TJ5gslLv1dJCVF0M is the link to the game. I need someone to help me big time. I know it's slightly ahistorical.
Logged
Power/metagaming RL since Birth/Born to do it.
Quote from: Second Amendment
A militia cannot function properly without arms, therefore the right of the people to keep and bear Arms, shall not be infringed.
The military cannot function without tanks and warplanes, therefore the right of the people to keep and bear tanks and warplanes, shall not be infringed.
The military cannot function without ICBMs, therefore the right of the people to keep and bear ICBMs, shall not be infringed.

eerr

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9776 on: June 23, 2016, 03:56:19 am »

So there's an assessment due tomorrow, in actionscript. I'm doing a kind of TD game, but without paths, the enemies spawn on the edges and go straight for the HQ. Right now though, the enemies spawn the whole stage width when I've specified them to only spawn on the first 400 pixels of width. The infantry continuously miss the HQ and no guns nor money system work. It's very unfinished and I wished I'd started it sooner. There may be comments which don't make sense, because it's a upgun of a previous assessment.


https://mega.nz/#!ZEZVQBbY!IU2ya2KFoQMUK1CGdZYCCGIqFh0TJ5gslLv1dJCVF0M is the link to the game. I need someone to help me big time. I know it's slightly ahistorical.
How do I run this?

Edit: actually the program is rather basic but I don't know how to source dive the spawn code. can't help *shrug.
« Last Edit: June 23, 2016, 04:02:24 am by eerr »
Logged

Insanegame27

  • Bay Watcher
  • Now versio- I mean, age 18. Honestly not an AI.
    • View Profile
    • Steam ID
Re: if self.isCoder(): post() #Programming Thread
« Reply #9777 on: June 23, 2016, 04:03:18 am »

To play it as I have this, run the .swf file. To look in the code, open the .fla in something like flash professional (what my school brought me)
or
https://www.google.com.au/search?num=100&rlz=1CAHPZY_enAU690AU690&q=flash%20programming%20software&oq=flash%20programm&gs_l=serp.3.4.0l10.13261.18707.0.21725.16.13.1.0.0.0.743.2680.2-2j1j0j2j1.6.0....0...1c.1.64.serp..9.6.2457.0..0i67.Ak1jaLsgFFY&safe=active&ssui=on
find something that can open .swf. I've never used anything other than Flash Professional CS6 to do it, though.
Logged
Power/metagaming RL since Birth/Born to do it.
Quote from: Second Amendment
A militia cannot function properly without arms, therefore the right of the people to keep and bear Arms, shall not be infringed.
The military cannot function without tanks and warplanes, therefore the right of the people to keep and bear tanks and warplanes, shall not be infringed.
The military cannot function without ICBMs, therefore the right of the people to keep and bear ICBMs, shall not be infringed.

eerr

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9778 on: June 23, 2016, 04:55:57 am »

Alright so I managed to hack together the code required to run a local file in a browser. I hate HTML for all its bimbos and caret cancer.

file:///*Path/Berlin_TD.swf pasted into the browser bar.
The only bug I can see is that some of the monsters from the top right side are overshooting the HQ. They are a little bit northwest at their closest point.
From the code I saw uncompiled, that might be a rounding error. Or just a little bit offset because the units are smaller than the HQ.
math.random should give you a floating point value BETWEEN 0-1 and probably rounds down by integer logic. so type 9 units might be a bit rare.

I can't tell if there is a way to place towers, or if it's not implemented yet.

and your units all spawn off-screen just fine, except I guess they like walking over the menu... okay that is bad.

Bring that menu on the side to the front of the screen.
As long as you cover it up it's not dirty.
Logged

Insanegame27

  • Bay Watcher
  • Now versio- I mean, age 18. Honestly not an AI.
    • View Profile
    • Steam ID
Re: if self.isCoder(): post() #Programming Thread
« Reply #9779 on: June 23, 2016, 05:09:31 am »

I have Math.ceil(Math.random()*9) to force a rounding up, so it'll give me 9 lots of something between 0-1 then rounds.


No way to place towers, any idea how I can get them to target and prioritise enemies? I'm thinking that MGs will focus on unit types 1-3 then 4-6 then 7-9. Flak should prioritise 4-6, then 1-3, then 7-9. Then field guns should target 7-9, 4-6 then 1-3. But I don't know how.

Them walking on the menu is bad.
EDIT I fixed it. Now how to tower.
« Last Edit: June 23, 2016, 05:17:07 am by Insanegame27 »
Logged
Power/metagaming RL since Birth/Born to do it.
Quote from: Second Amendment
A militia cannot function properly without arms, therefore the right of the people to keep and bear Arms, shall not be infringed.
The military cannot function without tanks and warplanes, therefore the right of the people to keep and bear tanks and warplanes, shall not be infringed.
The military cannot function without ICBMs, therefore the right of the people to keep and bear ICBMs, shall not be infringed.
Pages: 1 ... 650 651 [652] 653 654 ... 796