Jump to content

Fire Dragon

Members
  • Posts

    159
  • Joined

  • Last visited

Everything posted by Fire Dragon

  1. Hi!I have some questions about variables and OOP.Here:1.Can create something like this with variables.variable 1: value=100variable 2:value=10Then when user presses button, variable 2 decreses variable 1 using it's own value.Like 100-10=90.After this,it changes it's own value to 0.(or decreases it own value using it's own value.Sounds confusing I know.)Code must work this kind always,if user changes variable 2's value,it decreases variable 1 using it's own value.Even it is 14,78,66 etc.2.About OOP,if I create value for my object,like 100,can I decrease or increase it like this way: function computer(height,width,weight){this.heigth = height;this.width = width;this.weight =weight;}computer1 =new computer("80","60","20")computer1.width = "186"; And can I place event,what happens when computer.width = "0" ?Or can I use - and + operators with objects same way than variables?
  2. I meet new problem with this code.I tried make two mouse trails for same page.One is that bomb trail,and another one is familiar trail what only follows mouse.Well,when I set "normal" mouse trail to my html-document,it disturbs bomb trail.Bomb first moves,but then it stops and only shakes.Another trail works fine.What can cause this,and how I can fix this(if it is even possible)?I really need help,again Finally,here is my full code: <html><head><body><script>picFollow = new Image();picFollow.src = "bomb.gif";document.onmousemove = getMousePosition;document.onmouseout = pauseBomb;document.write("<div id=\"diva\" style=\"position:absolute\">");document.write("<img name=\"pic\"src=" + picFollow.src + "></div>");var picX = 20;var picY = 100;var step = 10;var speed = 1;var tolerance = step/2 +1;var mouseX = 0;var mouseY = 0;var mouseOut = true;var followMouse = false;function pauseBomb() {mouseOut = true;}function getMousePosition(e) {mouseX = window.event.x + document.body.scrollLeft;mouseY = window.event.y + document.body.scrollTop;mouseOut = false;if (followMouse) {diva.style.left = mouseX - pic.width / 2;diva.style.top = mouseY - pic.height / 2; }}function calcNewPos() {if (mouseX == picX)return;arg = (mouseY-picY) / (mouseX-picX);mult = 1;if (mouseX - picX < 0)mult = -1;alpha = Math.atan(arg);dx = mult * step * Math.cos(alpha);dy = mult * step * Math.sin(alpha);picX += dx;picY += dy;}function collision() {if ((Math.abs(picX-mouseX) < tolerance) && (Math.abs(picY-mouseY) < tolerance) && (!mouseOut))return true;return false;}function hideAnimation() {diva.style.visibility = "hidden";}function moveBomb() {calcNewPos();window.status = "("+mouseX+","+mouseY+")";diva.style.left = picX - pic.width / 2;diva.style.top = picY - pic.height / 2;if (collision()) {clearInterval(myInterval);followMouse = true;setTimeout('hideAnimation()', 2000);window.location="http://www.google.com" //Go to this page when bomb hits mouse }}myInterval = setInterval('moveBomb()', speed);/************************************************************************************************************************/</script></head><body><style>#pic1{position:absolute; }</style><script>//Copyright 2001 Chase Cathcart. Please leave this in here.function trackit(){document.all.pic1.style.left = event.xdocument.all.pic1.style.top = event.yif(event.x < "1"){document.all.pic1.style.left = "1"}}document.onmousemove = trackit</script><img src="character.gif" id="pic1"></body></html> Thanks!
  3. Hi!I need code what changes mousecursor when page loads.However,I know how change it to hand or some else standard cursors,but I want change cursor to image file,like .gif.Is this even possible?I need this because I have in my page one mouse trail what tries catch cursor.If I use normal trail code with it,it gets crazy.Thanks for advanced!
  4. Woohoo!This is code what I tried find and create few hours!Thank you very much scott100!My dream has come to true
  5. Sorry if my explain was confusing I meaned something like this:Bomb starts chasing mouse when page is loaded,like it now do.Then,if it touches cursor,it starts ONMOUSEOVER event with cursor,and example transfer you to new page.So I want that mouse has onmouseover event with bomb.Now it has samekind effect,but it only changes picture to explosion.I want that it redirectes you (or do something other),but it don't need change image.So I want replace this image changing to window.location,example.However,I can't find how change tjis feature. So:Mouse--><--Bomb =New URLThanks.
  6. Hi!I want create image,what follows mouse like this alien worm in Javascript FX site.I downloaded code,and I wanted put ONMOUSEOVER event for it,but then that code won't work.Do anyone know same kind code,what allows ONMOUSEOVER event?Code itself don't need be worm kind,like that,but it must follow mouse same way.And it would be nice,if it can work most of browsers,like Fire Fox.It is hard find these kind mouse followers,because often comes trails,what "touch" cursor,when I want trail what tries "catch" mouse cursor.Thank you for help!
  7. Well,I saw this kind code somewhere,but I can't remember where,so I decided ask.I want that,when tries close window,function happens.Like,alert "Bye,bye!" orprompt,"are you sure?"Something like this.I have seen this in some sites in web.Thanks for help!
  8. Yes,but it is in my computer text file named test.wml.And when I right click it,and check it features,there reads text file.So if I change name,it doesn't do anything.However,in my geocities account,I copied that file,and gave name test.wml,and it saved it to wml format.Last I tested it,and it was real wml file.So I got it work now.However,it would be more easy,if I can create wmls straightly,but this way only works.Hey!Now it works!It was probably temporary bug.Yippee!And thanks for help!
  9. Okay,but when I tested one of w3schools's example,pasted it to notepad,and saved test.wml ,it became txt file.Like this:test.wml.txtI know how save html files,and such,but with .wml ,it only creates .txt file.Or is it so,that it works still with cellphones,even it is like txt?I mean,that my computer don't notice that it is wml file,and thinks it is txt file.
  10. I started learning little WML,so I can put couple wap pages to my website.However I got very easy problem.How I can create wml documents?I tried with notepad,but created only txt file.Like this: test.wml.txtSo how I can create wml pages,do I need something special program,or what?And one little question:Do mobile phones support XHTML?I think so,but I can't be sure,because my phone supports HTML and PHP too. Thanks for help.PS:Do anyone know,do Geocities support wml,or xhtml?I can't find information about this on their site.
  11. Thank you ASpnetguy!That helps my studies very much!
  12. Nevermind.I just found generator for this.
  13. I tried make dropdown list to my website,I success create menu itself,but I have problems to create menu's options to links. <form><select name="R/S 252-386"><OPTION> 252 <OPTION> 253<OPTION> 254 </select> Here was my code.I can't find how change options to links.I saw one JS example,but after you select you must press button "GO!" etc.I want code,what sends you immediately to next page,after you selected something.Do I need JS for this,or can I create it only with HTML?Thanks.
  14. So if I understood it right,this clip creates new object,what should have image: new Sprite('sprite.gif'); However,it still won't work.With variable,or without variable.What I made wrong?I tried call object,but it won't work.Sometimes I feel,that I never learn OOP...
  15. Aspnetguy's code was little complicate,but if understood right,you can store image data in variable,and then call it for object using something like this code: var sprite_image=<img src="sprite.gif">object1.sprite=sprite_image; Something like this,eh?However,I not be sure about that image code in variable.
  16. Thanks guys,snif. :)By the way,is it "null" what destroys objects all values?
  17. I'm now in advanced section.However,in object section was some things like Boolean (what ever it is?)what I didn't understand,but what I learned with my JS book. Maybe I must give up,if I'm so bad coder,or hide somewhere to learn JS...
  18. I'm completely out now What you mean about this?I learned object programming from one book,and it tell object's creation completely different way Book shows that first you must create class with "this" clips,and after it you can create object.That's why I added thatthis.src=src;this.writer=writer;this.txt=txt;this.imager=imager code.Do you mean,that I must first create image <img src="lotad.gif">then get it someway "inside" my object?Or what?
  19. Okay then.Actually that wizard thing was only example,but I understand what you mean
  20. Ok,it is browser Zelda game for my The legend of Zelda website.Idea is that you must avoid enemies.Here is link to my game:The legend of Zelda Monster MadnessYes,it's crappy,but it's my first creation Here is link to .js file:MoveObjPS:Be careful that you can avoid first level's chickens,because I haven't finished game over screen,and it leads you to my finnish Zelda website
  21. Fire Dragon

    Delphi?

    What programming language Delphi is?I saw Delphi guide in library,and take quick look about it.I never before heared this programming language.Is it old,and is it good language?Just curious
  22. No,this only for my learning.I'm beginner with object programming,so I wanted ask this,because I didn't found way to do it.I created this kind test object based your example,but I can't get picture to show up.<script type="text/javascript">function wizard(src,writer,txt,imager){this.src=src;this.writer=writer;this.txt=txt;this.imager=imager;}blue=new wizard();blue.src="lotad.gif"blue.writer="Blaaaaaa!"blue.txt="text"blue.imager="imager"</script> What is wrong,huh?I can't get image to my object,no matter what I try
  23. Sorry It won't work because,it needs js file.
  24. I noticed,that it happens only when used Fire Fox.With Opera,it works fine.
×
×
  • Create New...