Fatt101's Profile
Reputation: 0
Apprentice
- Group:
- New Members
- Active Posts:
- 7 (0.04 per day)
- Joined:
- 18-December 12
- Profile Views:
- 296
- Last Active:
Jan 04 2013 02:05 PM- Currently:
- Offline
Previous Fields
- Dream Kudos:
- 0
Posts I've Made
-
In Topic: Keyboard events not working with images...
Posted 19 Dec 2012
<div id="PB"><IMG STYLE="position:absolute; TOP:150px; LEFT:400px; WIDTH:400px; HEIGHT:300px" SRC="Images/playboard.png"></div>
That is what i am trying to refer to, which is located within the <body> tag.
I am trying to move the image of the square between two fixed points, the top and bottom of the image 'playboard'. -
In Topic: Keyboard events not working with images...
Posted 19 Dec 2012
Still struggling with setting the boundary.
Think i have some of it figured out, however i am unsure what to set the variable names for PB_TOP, PB_WIDTH, PB_LEFT etc.
i thought it would be something like
var PB_HEIGHT=<div id="PB"<IMG STYLE="Height:300px" SRC = "Images/playboard.png"></div>
however, that isn't working.
The whole application now is not working, which i assume because of editing the code, below is the part i am adding to in order to create the boundary.
{ var elem = document.getElementById("sq2"); elem.style.position="absolute"; elem.style.left = x+"px"; elem.style.top = player1y+"px"; if (down_pressed) { if(player1y+MOVE_INC <= PB_HEIGHT) player1y+=MOVE_INC; } if (up_pressed) { if(player1y-MOVE_INC <= PB_TOP) player1y-=MOVE_INC; } }
anyone know where im going wrong? -
In Topic: Keyboard events not working with images...
Posted 18 Dec 2012
With any luck, the finished product will be an image of a ball with a randomly generated motion path, once it collides with either one of the squares they disappear, basically i am trying a game similar to the board game hungry hippos. Ideally there would be multiple balls with a score system in place, but im thinking small for the moment. I've been told by my tutor that i should not use a canvas, and should focus on using purely javascript, as apparantly it will just overcomplicate things. -
In Topic: Keyboard events not working with images...
Posted 18 Dec 2012
haha thats so frustrating!, thanks that part is all done now.
the next step is to fix a boundary around a image so that the squares move up and down in a fixed area...
am i right in thinking that it has something to do with setting border variables?, such as:
var bottomborder=500
var topborder=-28
var leftborder=10
var rightborder=600 -
In Topic: Keyboard events not working with images...
Posted 18 Dec 2012
Yes, you can.
Thanks - didn't realise, silly error
, still isn't fixed but at least i can stop pulling my hair out now and try and get back to figuring it out.
My Information
- Member Title:
- New D.I.C Head
- Age:
- Age Unknown
- Birthday:
- Birthday Unknown
- Gender:
Contact Information
- E-mail:
- Private
Friends
Fatt101 hasn't added any friends yet.
|
|


Find Topics
Find Posts
View Reputation Given
|
Comments
Fatt101 has no profile comments yet. Why not say hello?