Jump to content

Fire Dragon

Members
  • Posts

    159
  • Joined

  • Last visited

Everything posted by Fire Dragon

  1. Fire Dragon

    Object

    Well,I tried create my first object,what should draw image,write text etc.However,I got problem with image.I can't get it work.I tried put image's information into variable,but this idea crashed.How you recommend to put image or any other feature in object?Help is apreciated.Thanks.
  2. I made game where you must move mouse and avoid flying images.However it won't work with IE,I don't know why.Image flying code works with IE,Fire Fox and Opera,I tested it in other html document.However,in my game,it works only Fire Fox and Opera.I can't understand what can be wrong.It only don't create flying images in IE,in this html file.Can something code in my document disturb IE,or what?I checked my code couple of times,and I didn't find anything,what can disturb IE.BTW,I got flying code from here:Dynamic DriveAnd last,here is my game's first level's code.Warning!It's quite long,and it may contain some finnish words in comments etc. <html><head><title>Kakariko Village</title><script type="text/javascript" src="moveobj.js"> </script><script type="text/javascript">/************************************************ Floating image script- By Virtual_Max (http://www.geocities.com/siliconvalley/lakes/8620)* Modified by Dynamic Drive for various improvements* Visit Dynamic Drive at [url="http://www.dynamicdrive.com/"]http://www.dynamicdrive.com/[/url] for full source code***********************************************///Step 1: Define unique variable names depending on number of flying images (ie:3):var flyimage1, flyimage2, flyimage3function pagestart(){//Step 2: Using the same variable names as 1), add or delete more of the below lines (60=width, height=80 of image): flyimage1=new Chip("flyimage1",47,68);flyimage2=new Chip("flyimage2",47,68);flyimage3=new Chip("flyimage3",47,68);flyimage4=new Chip("flyimage4",47,68);flyimage5=new Chip("flyimage5",47,68);//Step 3: Using the same variable names as 1), add or delete more of the below lines:movechip("flyimage1");movechip("flyimage2");movechip("flyimage3");movechip("flyimage4");movechip("flyimage5");}if (window.addEventListener)window.addEventListener("load", pagestart, false)else if (window.attachEvent)window.attachEvent("onload", pagestart)else if (document.getElementById)window.onload=pagestart</script><!-- ONMOUSEOVER --><script type="text/javascript">function image(){window.location="http://www.geocities.com/zelda_life"}</script><!-- Time counter --><script type="text/javascript">function timedText(){var t1=setTimeout("document.getElementById('txt').value='59 seconds!'",1000)var t2=setTimeout("document.getElementById('txt').value='58 seconds!'",2000)var t3=setTimeout("document.getElementById('txt').value='57 seconds!'",3000)var t1=setTimeout("document.getElementById('txt').value='56 seconds!'",4000)var t2=setTimeout("document.getElementById('txt').value='55 seconds!'",5000)var t3=setTimeout("document.getElementById('txt').value='54 seconds!'",6000)var t1=setTimeout("document.getElementById('txt').value='53 seconds!'",7000)var t2=setTimeout("document.getElementById('txt').value='52 seconds!'",8000)var t3=setTimeout("document.getElementById('txt').value='51 seconds!'",9000)var t3=setTimeout("document.getElementById('txt').value='50 seconds!'",10000)var t1=setTimeout("document.getElementById('txt').value='49 seconds!'",11000)var t2=setTimeout("document.getElementById('txt').value='48 seconds!'",12000)var t3=setTimeout("document.getElementById('txt').value='47 seconds!'",13000)var t1=setTimeout("document.getElementById('txt').value='46 seconds!'",14000)var t2=setTimeout("document.getElementById('txt').value='45 seconds!'",15000)var t3=setTimeout("document.getElementById('txt').value='44 seconds!'",16000)var t1=setTimeout("document.getElementById('txt').value='43 seconds!'",17000)var t2=setTimeout("document.getElementById('txt').value='42 seconds!'",18000)var t3=setTimeout("document.getElementById('txt').value='41 seconds!'",19000)var t3=setTimeout("document.getElementById('txt').value='40 seconds!'",20000)var t1=setTimeout("document.getElementById('txt').value='39 seconds!'",21000)var t2=setTimeout("document.getElementById('txt').value='38 seconds!'",22000)var t3=setTimeout("document.getElementById('txt').value='37 seconds!'",23000)var t1=setTimeout("document.getElementById('txt').value='36 seconds!'",24000)var t2=setTimeout("document.getElementById('txt').value='35 seconds!'",25000)var t3=setTimeout("document.getElementById('txt').value='34 seconds!'",26000)var t1=setTimeout("document.getElementById('txt').value='33 seconds!'",27000)var t2=setTimeout("document.getElementById('txt').value='32 seconds!'",28000)var t3=setTimeout("document.getElementById('txt').value='31 seconds!'",29000)var t3=setTimeout("document.getElementById('txt').value='30 seconds!'",30000)var t1=setTimeout("document.getElementById('txt').value='29 seconds!'",31000)var t2=setTimeout("document.getElementById('txt').value='28 seconds!'",32000)var t3=setTimeout("document.getElementById('txt').value='27 seconds!'",33000)var t1=setTimeout("document.getElementById('txt').value='26 seconds!'",34000)var t2=setTimeout("document.getElementById('txt').value='25 seconds!'",35000)var t3=setTimeout("document.getElementById('txt').value='24 seconds!'",36000)var t1=setTimeout("document.getElementById('txt').value='23 seconds!'",37000)var t2=setTimeout("document.getElementById('txt').value='22 seconds!'",38000)var t3=setTimeout("document.getElementById('txt').value='21 seconds!'",39000)var t3=setTimeout("document.getElementById('txt').value='20 seconds!'",40000)var t1=setTimeout("document.getElementById('txt').value='19 seconds!'",41000)var t2=setTimeout("document.getElementById('txt').value='18 seconds!'",42000)var t3=setTimeout("document.getElementById('txt').value='17 seconds!'",43000)var t1=setTimeout("document.getElementById('txt').value='16 seconds!'",44000)var t2=setTimeout("document.getElementById('txt').value='15 seconds!'",45000)var t3=setTimeout("document.getElementById('txt').value='14 seconds!'",46000)var t1=setTimeout("document.getElementById('txt').value='13 seconds!'",47000)var t2=setTimeout("document.getElementById('txt').value='12 seconds!'",48000)var t3=setTimeout("document.getElementById('txt').value='11 seconds!'",49000)var t3=setTimeout("document.getElementById('txt').value='10 seconds!'",50000)var t1=setTimeout("document.getElementById('txt').value='9 seconds!'",51000)var t2=setTimeout("document.getElementById('txt').value='8 seconds!'",52000)var t3=setTimeout("document.getElementById('txt').value='7 seconds!'",53000)var t1=setTimeout("document.getElementById('txt').value='6 seconds!'",54000)var t2=setTimeout("document.getElementById('txt').value='5 seconds!'",55000)var t3=setTimeout("document.getElementById('txt').value='4 seconds!'",56000)var t1=setTimeout("document.getElementById('txt').value='3 seconds!'",57000)var t2=setTimeout("document.getElementById('txt').value='2 seconds!'",58000)var t3=setTimeout("document.getElementById('txt').value='1 seconds!'",59000)var t3=setTimeout("document.getElementById('txt').value='0 seconds!'",60000)}</script><!-- When time ends --><meta http-equiv="Refresh"content="60;url=monster_madness2.html"></head></head><body ONLOAD = "timedText()"><!-- Step 4: Define your flying images. For each image's ID tag, use the same variable names as 1) above --><DIV ID="flyimage1" STYLE="position:absolute; left: -500px; width:47; height:68;"><IMG SRC="kana.gif"onmouseover="image()" BORDER=0></a></DIV><DIV ID="flyimage2" STYLE="position:absolute; left: -500px; width:47; height:68;"><IMG SRC="kana.gif"onmouseover="image()" BORDER=0></a></DIV><DIV ID="flyimage3" STYLE="position:absolute; left: -500px; width:47; height:68;"><IMG SRC="kana.gif"onmouseover="image()" BORDER=0></a></DIV><DIV ID="flyimage4" STYLE="position:absolute; left: -500px; width:47; height:68;"><IMG SRC="kana.gif"onmouseover="image()" BORDER=0></a></DIV><DIV ID="flyimage5" STYLE="position:absolute; left: -500px; width:47; height:68;"><IMG SRC="kana.gif"onmouseover="image()" BORDER=0></a></DIV><!-- Image cursor--><script>/*Cross browser cursor trailer scriptBy Brian Caputo (bcaputo@icdc.com)Written permission granted to lissaexplains.comto distribute the script for personal use. (DO NOT REMOVE THIS)*/B=document.all;C=document.layers;T1=new Array("peli_link.gif",38,35)nos=parseInt(T1.length/3)rate=50ie5fix1=0;ie5fix2=0;for (i=0;i<nos;i++){createContainer("CUR"+i,i*10,i*10,i*3+1,i*3+2,"","<img src='"+T1[i*3]+"' width="+T1[(i*3+1)]+" height="+T1[(i*3+2)]+" border=0>")}function createContainer(N,Xp,Yp,W,H,At,HT,Op,St){with (document){write((! ? "<layer id='"+N+"' left="+Xp+" top="+Yp+" width="+W+" height="+H : "<div id='"+N+"'"+" style='position:absolute;left:"+Xp+"; top:"+Yp+"; width:"+W+"; height:"+H+"; ");if(St){if ©write(" style='");write(St+";' ")}else write((?"'":"");write((At)? At+">" : ">");write((HT) ? HT : "");if (!Op)closeContainer(N)}}function closeContainer(){document.write((?"</div>":"</layer>")}function getXpos(N){return ( ? parseInt(B[N].style.left) : C[N].left}function getYpos(N){return ( ? parseInt(B[N].style.top) : C[N].top}function moveContainer(N,DX,DY){c=( ? B[N].style :C[N];c.left=DX;c.top=DY}function cycle(){//if (IE5)if (document.all&&window.print){ie5fix1=document.body.scrollLeft;ie5fix2=document.body.scrollTop;}for (i=0;i<(nos-1);i++){moveContainer("CUR"+i,getXpos("CUR"+(i+1)),getYpos("CUR"+(i+1)))}}function newPos(e){moveContainer("CUR"+(nos-1),(?event.clientX+ie5fix1:e.pageX+2,(?event.clientY+ie5fix2:e.pageY+2)}if(document.layers)document.captureEvents(Event.MOUSEMOVE)document.onmousemove=newPossetInterval("cycle()",rate)</script><!-- Time counter field --><p>Aikaa jäljellä:</p><form><input type="text" id="txt"></form><!-- Background music --><EMBED SRC="http://www.geocities.com/zelda_life/Z3villag.mid" LOOP=TRUE AUTOSTART=TRUE HIDDEN=TRUE><!-- Background --><body background="http://i43.photobucket.com/albums/e366/kyogre_atlas/Zelda%20spritet/lttp4.gif"> I really apreciate your help,if you can help me find what is wrong.
  3. Can I like create object when program is running?And then,when something happens,destroy it?Like this way.Example in game there is wizard what creates fire ball object,what then flyes towards to your character.If your character collides to it,you lose HP.So how I can make it so wizard like creates that fire ball object?I just learned OOP's basics,but I don't know how call them That was easiest thing,I think.Next is little harder.How set it so that fire ball disappearafter some seconds or when it hits player?I know collinsion code,but how I can destroy object?And one more thing,how I can create that same object again,because I want that wizard shoots more than one fire ball?So like how turn object "on" and "off"?Thanks for help.
  4. My image,and html document was in same folder.Original CSS code don't use images.
  5. Yes,it worked now with me too,but how prevent it to pop same message many times?Because,as long when cursor is over picture it creates new and new and new message.And when you press OK,you got same message again.What I should to do?
  6. I find phong game code what can use freely in websites,and I wanted little change it's graphics,before I put it into my website.However,I really don't know anything about CSS(I think start it's learning after JS)so I need litle help modifying this code.Well,in game,ball is black square,and I want replace it to gif image.How it happens?Here is code: #ball { position: absolute; top: 160px; left: 210px; width: 7px; height: 7px; clip: rect(0px 7px 7px 0px); background-color: #555; z-index: 2; display: none;} I made quick look to w3schools' tutorial,but I didn't find anything.
  7. I tried make character,what speaks when you bring cursor over it.I got it worked before,but now it won't work.And with all this,I have another problem.When you bring mouse over character,message appears,but as long that mouse is over character,message pops again and again.I tired handle this problem with break; ,but it won't work,or it ruined whole character's speak.What is wrong?Here is my character's code: <img src="http://i43.photobucket.com/albums/e366/kyogre_atlas/Zelda%20spritet/npc_wizard.gif"onmouseover="wizard()" style="position:absolute;top:200px;left:0px"> And here is my character's text box: <script type="text/javascript">function wizard(){alert("Blaa,blaa, blaa,blaa,blaa,blaa,blaa,blaa,blaa," + '\n' + "blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa," + '\n' + "blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa, " + '\n' + "blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,")}</script>
  8. if(collision(top,left,t_val,l_val)){alert('collision');var img1 = document.getElementById('img1');document.body.removeChild(img2);switchpull() <form><img id="img1" src="lotad.gif"style="position:absolute;top:100px;left:100px;width:100px;height:100px" alt=""/><img id="img2" src="lotad.gif"style="position:absolute;top:300px;left:300px;width:100px;height:100px" alt=""/></form> This is my modified code.I changed variables,but it won't work.I'm little confused about this code: var switchObj = document.getElementById('switchId');document.body.removeChild(switchObj); I must replace "switchId" t0 my image's id,right?But I must to do about "switchObj"?Is it something to do with object oriented programming's objects?I mean,I haven't learned how use OOP,so I don't use objects in my code.I have mind level,where you must kill all enemies,moving huge cube over them.Thanks.BTW,good luck for your Pacman game!It looks very good!However,moving Pacman won't work with Fire Fox.
  9. Argh,that was little hard to understand,especially,when my mother tongue isn't english,and my game's code is now about one metre,so it hard find just right code piece,even it is well organized.And of course Imust modified it little,and it turned slightly different... Because that,I made this simpler script.It's code is like identical with another. <html><head><title>JavaScript key press event</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><script type="text/javascript">document.onkeydown = KeyCheck;function KeyCheck(e){var KeyID = (window.event) ? event.keyCode : e.keyCode;switch(KeyID){case 37:moveImg(0,-100);break;case 38:moveImg(-100,0);break;case 39:moveImg(0,100);break;case 40:moveImg(100,0);break;}}function moveImg(top,left){var img = document.getElementById('img1');var t = img.style.top;var t_val = parseInt(t.substring(0,t.length-2));var l = img.style.left;var l_val = parseInt(l.substring(0,l.length-2));if(collision(top,left,t_val,l_val)){alert('collision');var img1 = document.getElementById('imgId');document.body.removeChild(img1);switchPull();}else{img.style.top = (t_val + top) + 'px';img.style.left = (l_val + left) + 'px';}}function collision(top,lft,topNow,lftNow){if((topNow+top)==300 && (lftNow+lft)==300)return true;elsereturn false;}</script></head><body><form><img id="img1" src="lotad.gif"style="position:absolute;top:100px;left:100px;width:100px;height:100px" alt=""/><img id="img1" src="lotad.gif"style="position:absolute;top:300px;left:300px;width:100px;height:100px" alt=""/></form></body></html> I understood variables,but still,I can't figure,what is wrong.I know,I'm annoying,when I don't understand anything...
  10. OK.Something what I thought.I should try it...
  11. Argh,I can't get it work right now.I put it into the event,what happens,when pictures collides,but it not seem to work. if(collision(top,left,t_val,l_val)){alert('collision');var img1 = document.getElementById('img1Id');document.body.removeChild(img1); And here is my switch and block code: <form><img id="img1" src="http://i43.photobucket.com/albums/e366/kyogre_atlas/Zelda%20spritet/kuutio.gif"style="position:absolute;top:100px;left:100px;width:100px;height:100px" alt=""/><img id="img1" src="http://i43.photobucket.com/albums/e366/kyogre_atlas/Zelda%20spritet/switch.gif"style="position:absolute;top:300px;left:300px;width:100px;height:100px" alt=""/></form> What I now did wrong!? :)BTW,Is it meaned for "real" objects?I headr,that there is code,what destroys objects,but my code don't have objects yet,because I'm just beginner with them,like whole JS :)Can I create walls for my picture?So you can't move it throught other pictures,what are like walls.
  12. I knew that before,but about that collinsion effect.It regonizes them.I had invisible image,and when other objact collided to it,I got that collinsion message.I need this,because I plan that you must push object to the switch,and when it hits to it,switch disappears.
  13. Ah,I think variable using too.So I make only code like this in stairs: <script type="text/javascript">var switch =falsefunction stairs()if(switch==true){window.location"http://www.w3schools.com"}</script> And this kind in switch: <script type="text/javascript">var switch ==true</script> Is this code workable?I'm not be so sure about switch's code,what must turn var to true...
  14. BTW,can I prevent that it don't notice images what's has code style="display:none" And notice images what are visible?
  15. Yes,that is part,what I figured myself,but how I can prevent events over stairs,and then,when player presses switch,prevent disappears,and onmouseover code works with stairs?
  16. Hmm,how?I planned for my mouse game stirs image,and when you move cursor over it,it transter you to new level.This I can make easily with mouseover,but I want make around stairs wall,and you must destroy wall pressing switch.After that walls disappear(with ID code)and now,when you move mouse over stairs,it moves to next level.If I understand your post right,something like this is possible?
  17. Okay,however,I don't need so accurare code now,for my game,because I planned use it only some marquee images.Thanks.
  18. I make now mouse based game,and I need somekind "mouse barrier".So question is,how make image,that prevents you to move mouse over it?Example,if I create square with these image objects, you can't move mouse cursor inside square.Is thiskind code possible?Thanks for help.
  19. Now I understand.BTW,is there way to make it move smaller steps,and still have collinsion?Is it hard to make?However,this is enought for my game,so thanks.
  20. Ok.One problem occurred.I increased pictures width,and heigtht to 100,but after that,they won't work,and message don't appear.Why?It worked fine with 10x10 pictures,but with 100.BTW,is that width and height really needed anyway?I like use images original sizes.I can't find code clip,what prevents resizing image,or value what haves 10px.
  21. Well,I want know,is there somekind code what makes something to happen,when example two pictures,or objects collides?Like this way:x yY moves and collides to xxyWhen they collides,they creates new picture or object z.xy zSo how I can,if this is even possible make this kind effect?Do I need ID code,and set it somekind,so when objects collides,happens something?This little odd question,but I hope that someone can help.Thank you very much.
  22. Thanks for the code Aspnetguy.
  23. Hmm,I just got what I needed,but I don't know,is it good way to do that.Why not only use absolutely location?Set only pixel height and width.
  24. OK.So it works like that...thanks.BTW,is there way to make samekind effect,but you only need press key,and it moves,and when you release it,picture stops?Like usually in RPGs or other games.If it requires completely new code,forget,it isn't so important,but if I only need some little modifying,it would be nice know it.However,thanks,that was enought for me.
×
×
  • Create New...