• Avatar of Holy Cow
  • Let's put a smile on that face...
  • Group: Premium Member
  • Joined: Jun 8, 2008
  • Posts: 54
I'm a total newb just like you (and I use C# instead of JS which also complicates things) but I'll just throw it out there:
 
If you want to collide the Is Trigger button must be DEACTIVATED otherwise collision will be ignored.
Also, since you're not using the trigger options your function shouldn't be the onTriggerEnter but something related to collision. In C# there are functions like "OnCollisionEnter" and "OnCollisionExit" to regulate what happens when a gameobject touches another. Try to find their counterparts in javascript i you can
  • Avatar of Holy Cow
  • Let's put a smile on that face...
  • Group: Premium Member
  • Joined: Jun 8, 2008
  • Posts: 54
What about if the site uses google adsense? I guess that changes things  :dry:
  • Avatar of Holy Cow
  • Let's put a smile on that face...
  • Group: Premium Member
  • Joined: Jun 8, 2008
  • Posts: 54
Hi,
 
We've been making a blog about vintage toys for some time now but we are stuck when it comes to banners and other similar stuff that requires images. At first I thought I could just browse google images and pick up stuff from there and make them into a banner but a friend pointed out that those might be copyrighted and we might get sued or whatever. I thought that this would be a bit of an overreaction but after looking it up I found out that there are many people with sticks up their butts that not only will ask you to remove the picture but they will also continue on and sue you even if you respond immediately. We've all seen lots of stupid sh!t copyright-wise (Barkley game comes to mind) that's why I'm asking you guys for some advice on this. Use google images for G.I.Joe, TNMT, power rangers and other toys or not?
  • Avatar of Holy Cow
  • Let's put a smile on that face...
  • Group: Premium Member
  • Joined: Jun 8, 2008
  • Posts: 54
Dumb me didn't check first to see if there are any cursor attributes etc. About the user experience you might be right but the thing is, when hovering over the menu tab there is some text that appears and the cursor makes it difficult to read some times so this is why we're trying this. Thanks for the reply gonna test it out now
  • Avatar of Holy Cow
  • Let's put a smile on that face...
  • Group: Premium Member
  • Joined: Jun 8, 2008
  • Posts: 54
Hi, I have a blog I'm making and I would like to make a script that makes the mouse disappear when it hovers over a specific link (the menu tabs). Is that possible? And if yes, how can someone make it? (using what?). BTW I'm making this blog on blogger so consider any restrictions that might apply.
 
PS: I know this isn't exactly programming but it is technology right?
  • Avatar of Holy Cow
  • Let's put a smile on that face...
  • Group: Premium Member
  • Joined: Jun 8, 2008
  • Posts: 54
Just to hype it up, the solution actually worked ;)

Giving (pch=strtok(str,";"))!=NULL as a condition in the while string just makes it exit by itself when it encounters the end of the line. Thanks for pointing that out Biggles I totally missed it.

Programming is still not dead it seems :D
  • Avatar of Holy Cow
  • Let's put a smile on that face...
  • Group: Premium Member
  • Joined: Jun 8, 2008
  • Posts: 54
Don't worry I found it.
If anyone cares:
Secret of Mana - Star of Darkness
  • Avatar of Holy Cow
  • Let's put a smile on that face...
  • Group: Premium Member
  • Joined: Jun 8, 2008
  • Posts: 54
I'm pretty sure this is the solution that I was looking for... Either my english failed me or I was careless when reading about strtok cause I do not remember anything about it behaving specifically after the last token...
  • Avatar of Holy Cow
  • Let's put a smile on that face...
  • Group: Premium Member
  • Joined: Jun 8, 2008
  • Posts: 54
RRRRAAAAHHHH!! What's up with gamingw! It used to be full of so many programmers you could get answers on Cobol questions! Hell this is where I started to learn how to program before we were even taught what a variable is in school. Its been my go to place for anything programming related cause the community rocks but its numbers seem to have narrowed down alot :(
  • Avatar of Holy Cow
  • Let's put a smile on that face...
  • Group: Premium Member
  • Joined: Jun 8, 2008
  • Posts: 54
     FILE *fp;
     char line[200],dump[200];
     int entries,counter=0;
     char *pch;


     fp=fopen("a.txt","r");
     fgets(line,3,fp);
     entries=atoi(line);
     
     CARD table[entries]; //CREATING BASE TABLE FOR CARDS
     
     while (fgets(line,200,fp) != NULL && feof(fp) == 0){
           pch=strtok(line,";");
           strcpy(table[counter].code,pch);
           pch=strtok(NULL,";");
           table[counter].year=atoi(pch);
           pch=strtok(NULL,";");
           table[counter].day=atoi(pch);
           pch=strtok(NULL,";");
           table[counter].cost=atof(pch);
           pch=strtok(NULL,";");
           table[counter].shop_id=atoi(pch);
           pch=strtok(NULL,";");
           
           table[counter].next_item=(PRODUCTP) malloc(sizeof(PRODUCT));
           strcpy(table[counter].next_item->id,pch);
     
     }


After the table[counter].shop_id comes the part i'm talking about. I found out how to remove the '\n' character from the whole line (through using strtok with sole delimiter the '\n' char) but that still does not give me a clue about how I will know how many items to look for and make my loop...
  • Avatar of Holy Cow
  • Let's put a smile on that face...
  • Group: Premium Member
  • Joined: Jun 8, 2008
  • Posts: 54
I have a problem for 2 days now I haven't been able to exactly figure out. I have a txt file that his a list of stuff divided by semicolons (; character) and at the end it has a newline character for the next list, just like so:

...other stuff...;S234;S654;P768;P98
...other stuff...;P4;P654;S123;S432
...other stuff...;P90;S673;S879

As you can see it is random how many items we get in each line and what I want to do is to put each item in a linked list according to its line in an array. It has to look like so:

array[0] -> ...other stuff... S234 -points to-> S654 -points to-> P768 etc.
array[1] -> ...other stuff... P4 -points to-> P654 -points to-> S123 etc.
array[2] -> ......

I've made the fgets loop and all works it reads each line etc, but I'm stuck to the internal loop required in order to read each item separately inside the line given by fgets. Since it is random how many items we have in each line I can't put the strtok a predetermined amount of times inside the fgets loop and I still can't figure out what to do in order to condition the internal loop to understand that it has to exit after it finds the newline character (since this is our queue to go to the next line). Let me remind you that through strtok you can cut the whole string off according to the tokens but that does not mean that the last characters of the string array are the same as what you see after a printf("%s"). There are many junk characters thus I cannot check if the last char is a newline character...
  • Avatar of Holy Cow
  • Let's put a smile on that face...
  • Group: Premium Member
  • Joined: Jun 8, 2008
  • Posts: 54
I was watching this really nice cross over video and it played a old school video game soundtrack at 8:40 that I used to have but now I can't remember where it is from:


http://www.youtube.com/watch?v=IdYpn57j3VM
  • Avatar of Holy Cow
  • Let's put a smile on that face...
  • Group: Premium Member
  • Joined: Jun 8, 2008
  • Posts: 54
There's gonne be a sequel to chronicle? Just watched it like 5 days ago too and it didn't seem so. Anyway, watched Flying Swords of Dragon Gate last night. Jet Li "Hero" type movie not that bad but I wouldn't recommend it if you don't have alot of spare time.
  • Avatar of Holy Cow
  • Let's put a smile on that face...
  • Group: Premium Member
  • Joined: Jun 8, 2008
  • Posts: 54
Found the fix. For string comparison it should be type.equals("STOP") not ==.
  • Avatar of Holy Cow
  • Let's put a smile on that face...
  • Group: Premium Member
  • Joined: Jun 8, 2008
  • Posts: 54

New project now and got a fast question:


I'm doing some inputs using the BufferedReader type and its readLine() method. I'm inside a nested while loop that goes on as long as a boolean is false. When I input the word STOP in the BufferedReader, right after that I have an


if(type=="STOP") {
flag=true;
break;
}


The break exits the nested loop (which always runs till a break command is encountered) and after that I go into a switch for the "STOP" case that prints a message informing that the program is stopping all input. The problem is that the program seems to skip the IF case all together. After I input STOP, it will continue into the other commands of the loop instead of breaking out of it and then goes to the switch case normally printing the message but will start over the outside loop again which means that the flag hasn't changed from false to true. Code:


while (flag==false){
   while(true){


   try{
      line=in.readLine();
      type=new String(line);


      //I input STOP here


      if (type=="STOP"){
         flag=true;
         break;   //This is where is should break away from the nested loop...
      }
      
      line=in.readLine();
      x=new Integer(line);


      line=in.readLine();
      y=new Integer(line);
      
      
      line=in.readLine();
      inLine1=new Integer(line);
      
      break;
   }
   catch(IOException e){
      e.printStackTrace();
   }
   catch(NumberFormatException e){
      e.printStackTrace();
   }
}


   
   switch(type){
      case "STOP":
         System.out.println("Stopping input");     //This gets printed
         break;
      default:
         System.out.println("No such gate type! Start again");
         break;
   }
   
}  //After printing it will start over instead of exiting the outer while loop...
   System.out.println("Total end");
}
  • Avatar of Holy Cow
  • Let's put a smile on that face...
  • Group: Premium Member
  • Joined: Jun 8, 2008
  • Posts: 54
HOly mother of god. This is the best piece of work i've seen since Barkley. Encountered a bug though. After i got to the end of the demo i decided to play around some more encounters, and after changing the config to fast battle and fast world text, i entered a fight but the timer got stuck on Wait mode and wouldnt start counting. The music was still going so its not a crash we just all got stuck. I believe the animations stopped too (not 100% sure about that).

Otherwise, looking forward to trying 2D Final Fantasy VII. Marvelous
  • Avatar of Holy Cow
  • Let's put a smile on that face...
  • Group: Premium Member
  • Joined: Jun 8, 2008
  • Posts: 54
Maybe but I believe it makes the addDigit method more complicated since it has to analyse what the instance represents. Anyway I saw in the textbook that we will be using the .getSource() method soon in a more advanced (i guess) version of the interface so i'm gonna wait on that for now. Thanks for the help
  • Avatar of Holy Cow
  • Let's put a smile on that face...
  • Group: Premium Member
  • Joined: Jun 8, 2008
  • Posts: 54
It was actually much simpler than that. I just used a single ButtonHandler class and the ActionEvent event was named pushingButtoni. Then i just changed the addDigit method to append an integer in the StringBuffer and all was cool. I hadn't really understood how pushingButton event works and i still don't quite get where it comes from and whatnot. Checked the ActionEvent class from the documentation but it doesn't contain anything like that...
  • Avatar of Holy Cow
  • Let's put a smile on that face...
  • Group: Premium Member
  • Joined: Jun 8, 2008
  • Posts: 54
aspargus i didn't really get your method :S.




for(i = 0;i<10;i++){



button[ i ]=new Button(i.toString());
         this.add(button);  //This registers the button in the calculator's frame
         button.setBounds(new Rectangle(x,y,35,28));
         button.setFont(new Font("calibri", Font.PLAIN, 15));
         button.setBackground(Color.lightGray);
         
         switch(i){
         case 0:
            button.addActionListener(new Button0Handler(this));
            break;
         case 1:
            button.addActionListener(new Button1Handler(this));
            break;
         case 2:
etc


}




and the button handlers:



class Button0Handler implements ActionListener{
   CalculatorGui cg;
   public Button0Handler(CalculatorGui cg){
      this.cg=cg;
   }
   
   public void actionPerformed(ActionEvent pushingButton0){
      CalculatorGui.op.addDigit('0');  //This is a method from another class in order to add the digit in a stack.
     
   }
}




etc.


That's how the code is structured. What do i do exactly? :D
  • Avatar of Holy Cow
  • Let's put a smile on that face...
  • Group: Premium Member
  • Joined: Jun 8, 2008
  • Posts: 54
Alright got another question now on a new project we are working on:

We now transitioned from using a premade GUI to making our own calculator GUI, using the awt. In the example they gave us, the GUI had initialized every single button required by the calculator as a Button instance with a distinct name etc. Along with that he wrote 15 times the same code for designing, positioning, registering, and adding the action listener. We were asked to change that copy-paste stuff with some more programmy stuff (didnt tell us what). So someone mentioned making a FOR loop that will create each instance, position it on the frame of the calculator etc. However I believe java can't create instances by itself using an index integer like buttoni (where i=0,1,2...). So i put them in an array. 2 issues here:

1. I'd like a fast insight on my way of doing this. Is there a better way/more appropriate?

2. In order for each button to work it requires ButtonXHandler classes that implement the Action Listener interface and use ActionEvent method to recognize the click action from the mouse. The question is: Can i avoid writing 10 Button Handler classes like i did with the buttonX instances? I don't think i can create them with a loop but i may be wrong...


Thanks in advance