Swapping A Solid Color Tile For An Image File In Game Map Background?
Nov 18, 2011
I've created a javascript version of the classic game SOKOBAN. Basically what happens is you move the man around the "warehouse" and he must push the boxes into the target area. Copy the code and try it yourself to see what I have so far (note-he can't move the boxes yet).
My question is: Right now, my map consists of solid color blocks. What I WANT them to be is image files (for example: box.png, wall.png, floor.png) to add a little versatility and life to the map. I am not sure how to make this switch though. I suspect I make the change somewhere in the tile array in the initialize function, but I am not sure what..
Also, how can I get the boxes to actually MOVE? I.e. when my man pushes them, they move around in the direction he pushes?
View 3 Replies
ADVERTISEMENT
Aug 24, 2010
provide javascript to create something like the image below: Things I can't workout are:
1. top and bottom background colors as the above image
2. add two text
3. border color same as top background color
[Code]....
View 1 Replies
View Related
Jan 20, 2009
Ideas on Java script Tile base game engine. You know.. with click to walk (or keyboard), inventory, grab items, talk to people, exp, levels, etc.
View 1 Replies
View Related
Jan 16, 2008
i have anerror when i try to swap background images, it works fine in firefox, safari, opera but in IE7, i get this :
[Code]...
View 3 Replies
View Related
Nov 22, 2010
i creating a 'map' for my game. I've got a 13x13 tile layout and using PHP I've loaded all the tiles.What I'm looking to do is grab all the tiles whose class names are 'water' and create a loop that'll change their background every second between four possible images.
View 1 Replies
View Related
Dec 17, 2009
I want to know how to change the background of my site to an image instead of a color using buttons.so far i have this code
<input type="button" value="Red" onclick="changeBgColor(this.value);" />
<input type="button" value="blue" onclick="changeBgColor(this.value);" />
<input type="button" value="Yellow" onclick="changeBgColor(this.value);" />[code]....
instead of changing the color i want to change it to an image, how would i do this?
View 3 Replies
View Related
Apr 15, 2010
I've got a JavaScript / CSS question if anyone has a spare minute and the interest? I've got a page with a background image set by CSS. I want to use a Javascript function to change that image with a link click. Here's a snippet from my HTML:
HTML Code:
<body>
<script type="text/javascript" src="changeBGimage.js"></script>
<style type="text/css">
body {background: url('red.jpg') no-repeat}
</style>
[Code]...
Would you be able to tell me how I would structure that function?
View 13 Replies
View Related
May 5, 2011
How to create an image tile effect, does anyone know any way, or how it works?
View 13 Replies
View Related
Apr 24, 2011
have been trying to rework this to call additional, independent sets of colors to cycle through (so it would loop thru a set of grays, a set of primary colors, etc). I would use perhaps a different function name in the HTML to call different sets of colors. If this is more complex than I think it is, I think 3 sets would be plenty. demo link of script in current state at bottom)
<html><head><title></title>
<script language=javascript>
colors = ["#cacdca", "#b2b4b2", "#969896", "#7d7f7d", "#ffff00"];
cRGB = [];
[Code]....
View 7 Replies
View Related
Jul 7, 2011
I'm faced with a problem trying to set background color under IE7. I have the following Javascript:
function showLayer793BKColor(id)
{
var txtObj = document.all(id);
[code]....
View 5 Replies
View Related
Apr 29, 2011
I am trying to change my sites background color. The color changes but it doesn't go back to the first image anymore. does anybody know what the problem could be?
jQuery Code:
HTML Code:
View 1 Replies
View Related
Feb 27, 2009
I have a div whose hover color is initially set through a CSS style sheet, but have found that if I change the background through a script, the hover is wiped out. Here's how I'm changing the colornode.style.backgroundColor = '#00FF00';Later on, I need to restore the normal color and have the hover still work. Is there any way to programatically reinstate the h
View 4 Replies
View Related
Feb 11, 2009
I have a form which contains FOUR text fields (e.g. TEXTFIELD1, TEXTFIELD2, TEXTFIELD3 & TEXTFIELD4). Each text field holds a HEX,DEC color value. ABOVE this form I have a table with TWO ROWS (ROW1 and ROW2). ROW1 should correspond with TEXTFIELD1, so that when the VALUE in TEXTFEILD1 is changed the background color of ROW1 will change to match the HEX,DEC VALUE entered in TEXTFIELD1. The same would happen with TEXTFIELD2 and ROW2. TEXTFIELD3 should be used to change the color of the TEXT inside ROW1 and TEXTFIELD4 should change the color of the TEXT in ROW2. I also wanted to know if it would be possible to achieve this without clicking any button.
------------------------------------------------------------------
| ROW1 | TEXT IN ROW 1
------------------------------------------------------------------
| ROW2 | TEXT IN ROW 2
------------------------------------------------------------------
TEXTFIELD1 <----HEXDEC VALUE GOES HERE to change color of ROW1---->[code]....
View 9 Replies
View Related
Oct 5, 2010
I am using superfish menu on the site below. http:[url]...when I go through the sub menus. parent menu item's "a color" turns into white again but not background color. then nothing is seen. I want it to stay as first hover condition (white bg and black text) when I walking through sub menus. I cannot override it.
View 1 Replies
View Related
Jul 20, 2001
I'm hoping that there is a simple script that can rotate images and text links on a page, always showing perhaps 5 or 10 images although in a different order every time. This would be used to equalize ads on a few of my sites, an example can be seen here Code:
View 1 Replies
View Related
Jan 24, 2002
okay, now i know this is probably really easy, but i have about a 2% knowledge of javascript (i know i should learn it)
anyway what im after is something that will do the following
i have 1 image that is 160x106 pixels, on the other side of the page i have 5 thumbnails (16x10pixels) now when somebody clicks on one of the 5 thumbnails i want the full size version of that picture to apear where the 160x106 picture is...
View 3 Replies
View Related
Mar 24, 2010
l need to apply a hover css on a radio button. Currently the background color only draws a box around the radio button but does not the actual radio color. l dont mind if there is no css even javascript will do
View 1 Replies
View Related
Jan 23, 2011
I have a simple navigation bar using an ul with images.
I have the following script that swaps out the images on mouseover and mouseout to create "hover" effect.
The issue is when I try to set the src attribute of the image that has been clicked the image does not change. The first part of the click event is working and resets the src of all the images as expected, but the second part that sets the src for the image clicked does not either run or runs before the reset.
View 3 Replies
View Related
May 18, 2009
Newbie here. I am seeking to swap out three images when rolling over one. Cursor hovers over one image - three new images, in different locations, are seen on screen. When cursor moves away - the images revert to "normal" state.
Image 1 - thumbnail - bottom right of screen
When rolling over Image 1, three images change:
Image 1 - to shaded version of the thumbnail
Image 2 - main image center of screen
Image 3 - text box image top right of screen
View 2 Replies
View Related
Oct 29, 2002
can you see whats wrong with the script I attached it has multi -level arrays and such, i couldn't get it to run smoothly....
View 3 Replies
View Related
Oct 29, 2009
I am updating an online scheduler for my office manager. I have encountered a particular problem that I can't figure out at all. The scheduler is a table organized by resource and time - if there is nothing scheduled but that particular resource/time is available a '+' is placed in the appropriate cell. A '-' is used for unavailability. When you hold your mouse over a '+', '-', or scheduled event (which is a colored box) a JS tooltip appears to provide information about that time or scheduled event. None of this is the problem.My problem is this: after adding the JS tooltip code IE on Windows XP (haven't tested on other OS's) exhibits a strange behavior. All the '+''s, when moused over, turn into a solid block which never reverts back to the '+'. It shouldn't become a solid block at all, btw. This same behavior is not observed for the '-''s.The code is large, so I won't post all of it, but I'll post what I think makes sense. This is the fxn where I've specified the tooltip:
/**
* Prints out blank columns
* @param int $cols number of columns to print out
[code]....
View 1 Replies
View Related
Nov 8, 2011
I m making a game in javascript and i recently found out about image maps and i dont understand how they work very well. Pritty much when you would click a specific spot it would change the picture to a different image map?
View 9 Replies
View Related
Feb 7, 2011
I been racking my brain for about an hour now, and cant seem to work this one out. I need to in javascript, get the HEX value (#FFFFFF) of a div's background color. style.backgroundColor doesnt seem to work. ut it seems to be different in every browser, and i cant seem to make it work. (it must work in IE, FF, Chrome, Safari) I have tried using a couple of examples, but nothing seems to work...
View 6 Replies
View Related
Mar 10, 2011
I was trying to make a Javascript game that moves an image across the screen randomly. Instead of executing properly, it just shows the image's starting point, and stops. No movement.
View 1 Replies
View Related
Jul 23, 2005
I have a function returning a string but the problem is that the
color of it is blue which suits me well for some pages but not for
others. Is it possible to "feel" what the color of the background
in the current document is and set the color of the output accordingly? The
background will be an image, in most cases.
View 11 Replies
View Related
Nov 7, 2005
what I would like to do with html / javascript is the following:
The url is something like: htmlfile.htm?color=blue
I want to grab the parameter "color=blue" and assign it to the
background color.
My problem is I don't know how to get the parameter via html /
javascript.
In ASP it's <%Request("color")%> but after searching with Google I
haven't come up with anything for html / javascript.
View 5 Replies
View Related