Topic: Need some help aiming an enemy sprite (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=30701" title="Pages that link to Topic: Need some help aiming an enemy sprite (Page 1 of 1)" rel="nofollow" >Topic: Need some help aiming an enemy sprite <span class="small">(Page 1 of 1)</span>\

 
racerX
Nervous Wreck (II) Inmate

From: Portland Oregon
Insane since: Jun 2006

posted posted 12-11-2008 02:38

Hello everyone, I could really use the help from the experts here. I'm working on a javascript version of the old atari classic combat. I found a 2d map script and modified it. I've got the routines all set for the shooting and moving around. right now I have an array with some values to run the sprite around and, to shoot its bullets, i'm just using the trigger for the player, the space bar. use the keys to move around. Anyway, I need some ideas on how to calculate the angle from the sprite to the player and how to trigger firing.
Here's the a link to the original script.
http://devfiles.myopera.com/articles/580/2dmap_collision.htm
(I found it while googling collision or something. Totally side-tracked me too. I was working on a pinball game at the time and all I needed was to figure out how to make the rules for the flipper collisions. another thread... another time LOL)
I tried to figure out who wrote it but it's some dudes home server I think. Anyway, It helped me learn some more and that's my goal.

NOW, on to the script at hand. I hope you guys have it in your heart to help me out.
Check out how the bullets can curve with the player angle just like the old game. Man, I loved atari.



code:
<html>
<head>
<title>JavaScript Wolfenstein 3D Engine - Player movement + collision</title>
<style>
div#minimapcontainer    {}
canvas#minimap 		{position : absolute;}
canvas#minimapobjects   {position : absolute;}
</style>
<script src="excanvas.js" type="text/javascript"></script>
</head><body >
<div id="minimapcontainer"><canvas id="minimap"></canvas><canvas id="minimapobjects"></canvas></div>
<script type="text/javascript">

var playerfire=false;
var enemyfire=false;
/*
var player = {
	x : 16,			// current x, y position
	y : 10,
	dir : 0,		// the direction that the player is turning, either -1 for left or 1 for right.
	rot : 0,		// the current angle of rotation
	speed : 0,		// is the playing moving forward (speed = 1) or backwards (speed = -1).
	moveSpeed : 0.18,	// how far (in map units) does the player move each step/update
	rotSpeed : 6		// how much does the player rotate each step/update (in degrees)
}
*/
var player = { x:16, y:60, dir:0, rot:0, speed:0, moveSpeed:0.18 , rotSpeed:6 }

var playerbullet = { x:player.x, y:player.y, dir: Math.cos(player.rot), rot:0, speed:0, moveSpeed:0.18 , rotSpeed:0 }


var enemy = { x:17, y:10, dir:3, rot:0, speed:2, moveSpeed:0.18 , rotSpeed:6 }

var enemybullet = { x:enemy.x, y:enemy.y, dir: Math.cos(enemy.rot), rot:0, speed:0, moveSpeed:0.18 , rotSpeed:0 }



var mapWidth = 0;
var mapHeight = 0;
var miniMapScale = 3;
enemyMovementTimer=0;
function init() {
mapWidth = map[0].length;
mapHeight = map.length;
bindKeys();
drawMiniMap();
gameCycle();	
}
function enemyfirefalse(){enemyfire=false;}
function firefalse(){playerfire=false;}

function gameCycle() {animate();move();updateMiniMap();setTimeout(gameCycle,1000/30);}
function move() {
if (enemyfire==true){setTimeout("enemyfirefalse()",60)}
if (playerfire==true){setTimeout("firefalse()",60)}

var moveStep = player.speed * player.moveSpeed;	// player will move this far along the current direction vector
player.rot += player.dir * player.rotSpeed * Math.PI / 180; // add rotation if player is rotating (player.dir != 0)
var newX = player.x + Math.cos(player.rot) * moveStep;	// calculate new player position with simple trigonometry
var newY = player.y + Math.sin(player.rot) * moveStep;
if (isBlocking(newX, newY)) {	// are we allowed to move to the new position?
return;} 


var movebulletStep = playerbullet.speed * playerbullet.moveSpeed;	// player will move this far along the current direction vector
playerbullet.rot += playerbullet.dir * playerbullet.rotSpeed * Math.PI / 180; // add rotation if player is rotating (player.dir != 0)
var newbulletX = playerbullet.x + Math.cos(player.rot) * movebulletStep;	// calculate new player position with simple trigonometry
var newbulletY = playerbullet.y + Math.sin(player.rot) * movebulletStep;

var moveEnemyStep = enemy.speed * enemy.moveSpeed;	// player will move this far along the current direction vector
enemy.rot += enemy.dir * enemy.rotSpeed * Math.PI / 180; // add rotation if player is rotating (player.dir != 0)
var newEnemyX = enemy.x + Math.cos(enemy.rot) * moveEnemyStep;	// calculate new player position with simple trigonometry
var newEnemyY = enemy.y + Math.sin(enemy.rot) * moveEnemyStep;
if (isBlocking(newEnemyX, newEnemyY)) {	// are we allowed to move to the new position?
return;}
	
var moveEnemybulletStep = enemybullet.speed * enemybullet.moveSpeed;	// player will move this far along the current direction vector
enemybullet.rot += enemybullet.dir * enemybullet.rotSpeed * Math.PI / 180; // add rotation if player is rotating (player.dir != 0)
var newEnemybulletX = enemybullet.x + Math.cos(enemy.rot) * moveEnemybulletStep;	// calculate new player position with simple trigonometry    
var newEnemybulletY = enemybullet.y + Math.sin(enemy.rot) * moveEnemybulletStep;


player.x = newX; // set new position
player.y = newY;
playerbullet.x = newbulletX; // set new position
playerbullet.y = newbulletY;
enemy.x = newEnemyX; // set new position
enemy.y = newEnemyY;
enemybullet.x = newEnemybulletX; // set new position
enemybullet.y = newEnemybulletY;

if (playerfire==true){
playerbullet.x = player.x; // set new position
playerbullet.y = player.y;
newbulletX=player.x;
newbulletY=player.y
playerbullet.speed=3; 
playerbullet.moveSpeed=0.68 
}

if (enemyfire==true){
enemybullet.x = enemy.x; // set new position
enemybullet.y = enemy.y;
newEnemybulletX=enemy.x;
newEnemybulletY=enemy.y
enemybullet.speed=3; 
enemybullet.moveSpeed=0.68 
}


}
//enemy movement test
pos = new Array();
pos[0] = "1,.18,1";
pos[1] = "2,.18,0";
pos[2] = "1,.18,0";
pos[3] = "1,.18,1";
pos[4] = "2,.18,0";
pos[5] = "1,.18,1";

bulletpos =new Array();
bulletpos[0] = "0,0,0";

var step = 0;
var laststep = pos.length;

var timer;

function animate()
{
enemyMovementTimer+=1
   step++;
   if(step == laststep) step = 0;
	var newpos = pos[step].split(",");
if(enemyMovementTimer==10){
   enemy.speed = parseInt(newpos[0]);
   enemy.movespeed = parseInt(newpos[1]);
   enemy.dir=parseInt(newpos[2]);

enemyMovementTimer-=10}
  // timer = setTimeout("animate()",200);
return;
}

function stopAnimation()
{
   clearTimeout(timer);
}


//end of sprtite movement test





function isBlocking(x,y) 
{ 
 // first make sure that we cannot move outside the boundaries of the level
if (y < 0 || y > mapHeight || x < 0 || x > mapWidth)

return true;
						// return true if the map block is not 0, ie. if there is a blocking wall.
return (map[Math.floor(y)][Math.floor(x)] != 0);}

function updateMiniMap() {
document.getElementById("minimapobjects").width = document.getElementById("minimapobjects").width;
document.getElementById("minimapobjects").getContext("2d").fillRect(player.x * miniMapScale ,player.y * miniMapScale ,4,4);
document.getElementById("minimapobjects").getContext("2d").beginPath();
document.getElementById("minimapobjects").getContext("2d").moveTo(player.x * miniMapScale+2, player.y * miniMapScale+2);
document.getElementById("minimapobjects").getContext("2d").lineTo((player.x + Math.cos(player.rot) * 4) * miniMapScale,(player.y + Math.sin(player.rot) * 4) * miniMapScale);
document.getElementById("minimapobjects").getContext("2d").closePath();
document.getElementById("minimapobjects").getContext("2d").stroke();

									
//enemy test begins here																//enemy test begins here

document.getElementById("minimapobjects").getContext("2d").moveTo(enemy.x * miniMapScale+2, enemy.y * miniMapScale);
document.getElementById("minimapobjects").getContext("2d").fillRect(enemy.x * miniMapScale ,enemy.y * miniMapScale ,4,4);
document.getElementById("minimapobjects").getContext("2d").beginPath();
document.getElementById("minimapobjects").getContext("2d").moveTo(enemy.x * miniMapScale+2, enemy.y * miniMapScale+2);
document.getElementById("minimapobjects").getContext("2d").lineTo((enemy.x + Math.cos(enemy.rot) * 4) * miniMapScale,(enemy.y + Math.sin(enemy.rot) * 4) * miniMapScale);
document.getElementById("minimapobjects").getContext("2d").closePath();
document.getElementById("minimapobjects").getContext("2d").stroke();

							//bullet test begins here	
document.getElementById("minimapobjects").getContext("2d").beginPath();	

document.getElementById("minimapobjects").getContext("2d").moveTo(playerbullet.x * miniMapScale, playerbullet.y * miniMapScale+2);
document.getElementById("minimapobjects").getContext("2d").fillRect(playerbullet.x * miniMapScale ,playerbullet.y * miniMapScale+2 ,3,1);
document.getElementById("minimapobjects").getContext("2d").closePath();
							
document.getElementById("minimapobjects").getContext("2d").beginPath();
document.getElementById("minimapobjects").getContext("2d").moveTo(enemybullet.x * miniMapScale, enemybullet.y * miniMapScale+2);
document.getElementById("minimapobjects").getContext("2d").fillRect(enemybullet.x * miniMapScale ,enemybullet.y * miniMapScale+2 ,3,1);
document.getElementById("minimapobjects").getContext("2d").closePath();							

}
function drawMiniMap() {
document.getElementById("minimap").width = mapWidth * miniMapScale;	
document.getElementById("minimap").height = mapHeight * miniMapScale;	
document.getElementById("minimapobjects").width = document.getElementById("minimap").width;
document.getElementById("minimapobjects").height = document.getElementById("minimap").height;
var w = (mapWidth * miniMapScale) + "px" 	
var h = (mapHeight * miniMapScale) + "px"
document.getElementById("minimap").style.width = document.getElementById("minimapobjects").style.width 
document.getElementById("minimap").style.height = document.getElementById("minimapobjects").style.height 
document.getElementById("minimap").getContext("2d").fillStyle = "white";
document.getElementById("minimap").getContext("2d").fillRect(0,0,document.getElementById("minimap").width,document.getElementById("minimap").height);
// loop through all blocks on the map
for (var y=0;y<mapHeight;y++) {
		for (var x=0;x<mapWidth;x++) {
var isAwall = map[y][x];//
if (isAwall > 0) { 
			//block at this (x,y) ...map[y][x] We got a wall!!


									document.getElementById("minimap").getContext("2d").fillStyle = "rgb(200,200,200)";
									document.getElementById("minimap").getContext("2d").fillRect(x * miniMapScale,y * miniMapScale,miniMapScale,miniMapScale);}}}
updateMiniMap();}
setTimeout(init, 1);
function bindKeys() {
	document.onkeydown = function(e){
e = e || window.event;switch (e.keyCode) { 
case 38: //  forward
player.speed = 1;break;
case 40: //  backward
player.speed = -1;break;
case 37: // left
player.dir = -1;break;
case 39: // right
player.dir = 1;break;
case 32: playerfire=true;enemyfire=true;break}}                                                           //0 stop player when key is released
document.onkeyup = function(e) {e = e || window.event;switch (e.keyCode) 
{case 38:case 40:player.speed = 0;break;case 37:case 39:player.dir = 0;break;}}}
var map = [
	[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
	[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
	[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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0,0,0,0,0,0,0,1],
	[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
	[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
	[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
	[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
	[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
	[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
	[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
	[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
];

</script>
</body>



Thanks everyone for sharing you talents and ideas. You make the internet an interesting place.

Arthurio
Paranoid (IV) Inmate

From: cell 3736
Insane since: Jul 2003

posted posted 12-11-2008 09:19

First you need some kind of logical algorithm of what you want the 'AI' to be able to do.
Ideally what you probably would want to do is something like this:
(for every bot and every update/frame)
1) check if player is in range
_2) check if player is in direct sight
__3) calculate the direction
__4) start turning in that direction
__5) check if direction is approximately correct
___6) move forward
___7) shoot
8) if player is neither in range nor in sight
_9) patrol

For starters you can skip the 'in direct sight' check.

edit: oops

(Edited by Arthurio on 12-11-2008 09:30)

racerX
Nervous Wreck (II) Inmate

From: Portland Oregon
Insane since: Jun 2006

posted posted 12-13-2008 04:53

thanks. I guess I should have been a little more specific about the help i need. What i need to know is what's the trig function I use to calculate the angle to a point (the player from the enemy perspective) from another point(the enemy). I have the XY coordinates obviously, so I need to test for all the values in the range of the specific angle to see if the player position falls in so I know the direction to move the enemy.

TO DO : LOL
I'm such a noob. I don't even know how to implement half of what I just wrote.

Maybe there's an example you could point me towards that I could learn from. Tutorials don't help too much. I have to see the code working and absorb it that way.
Maybe I'll look deeper into my scattered files to see if I have the answer somewhere on my machine already.

Thanks for your help

Arthurio
Paranoid (IV) Inmate

From: cell 3736
Insane since: Jul 2003

posted posted 12-13-2008 07:49

try Math.atan2(y,x)

Arthurio
Paranoid (IV) Inmate

From: cell 3736
Insane since: Jul 2003

posted posted 12-13-2008 15:58

x and y of course being the distances between player and enemy.

"The atan2() method returns the angle theta of an (x,y) point as a numeric value between -PI and PI radians."

So you have the direction your enemy should turn to. But you also have the current orientation of your enemy. I didn't understand why you have to check for every possible value.

just do this:

if (direction < orientation + 0.05 && direction > orientation - 0.05)
{
shootOrWhatever();
}

racerX
Nervous Wreck (II) Inmate

From: Portland Oregon
Insane since: Jun 2006

posted posted 12-20-2008 03:23

thanks for your help. I got sidetracked when I found out more info. I also found the source of the little game script. Ozone regular I think
http://dev.opera.com/articles/view/creating-pseudo-3d-games-with-html-5-can-1/

He has this as a tutorial page and so I combined my script as best I could to the raycaster and now I need help drawing the enemy in the raycaster before I can worry about where he's aiming. LOL I have been able to draw another div on the page to represent the enemy and the block images are working in the div, but I can't seem to pass my enemy location onto the the darn thing so it just sits there.

Thanks again for your help.

Here's my updated script.
I tried making a global variable to pass the enemy x y onto but that didn't work. I'm lost.

<html>
<head>
<title>JavaScript Wolfenstein 3D Engine - Player movement + collision</title>
<style>
div#minimapcontainer {}
canvas#minimap {position : absolute;}
canvas#minimapobjects {position : absolute;}





div#floor {
position : absolute;
width : 100%;
height : 100%;
background-color : rgb(128,128,128);
}

div#ceiling {
position : absolute;
width : 100%;
height : 50%;
background-color : rgb(96,96,96);
}


#screen {
position : relative;
width : 320px;
height : 200px;
top:0px;
border : 1px solid black;
overflow : hidden;
}

</style>
<script src="excanvas.js" type="text/javascript"></script>
</head><body >

<div id="screen">
<div id="floor"></div>
<div id="ceiling"></div></div>


<div id="minimapcontainer"></div><canvas id="minimap"></canvas><canvas id="minimapobjects"></canvas>
<script type="text/javascript">

var $ = function(id) { return document.getElementById(id); };
var dc = function(tag) { return document.createElement(tag); };
var stripWidth = 2;
var fov = 60 * Math.PI / 180;
var screenWidth = 320;
var screenHeight = 200;

var numRays = Math.ceil(screenWidth / stripWidth);
var fovHalf = fov / 2;

var viewDist = (screenWidth/2) / Math.tan((fov / 2));

var twoPI = Math.PI * 2;

var numTextures = 4;




var gamespeed =20;
var playerfire=false;
var enemyfire=false;
/*
var player = {
x : 16, // current x, y position
y : 10,
dir : 0, // the direction that the player is turning, either -1 for left or 1 for right.
rot : 0, // the current angle of rotation
speed : 0, // is the playing moving forward (speed = 1) or backwards (speed = -1).
moveSpeed : 0.18, // how far (in map units) does the player move each step/update
rotSpeed : 6 // how much does the player rotate each step/update (in degrees)
}
*/
var player ={x:16, y:60, dir:0, rot:0, speed:0, moveSpeed:0.18 , rotSpeed:3 }
var playerbullet ={xlayer.x, ylayer.y, dir: Math.cos(player.rot), rot:0, speed:0, moveSpeed:0.18 , rotSpeed:0 }
var enemy ={x:3, y:10, dir:0, rot:0, speed:1, moveSpeed:0.18 , rotSpeed:3 }
var enemybullet ={x:enemy.x, y:enemy.y, dir: Math.cos(enemy.rot), rot:0, speed:0, moveSpeed:0.18 , rotSpeed:0 }

var mapWidth = 0;
var mapHeight = 0;
var miniMapScale = 3;
enemyMovementTimer=0;

/********initiate the game***********/

function init() {
mapWidth = map[0].length;
mapHeight = map.length;
initScreen();
bindKeys();
drawMiniMap();
gameCycle();
}/********end init()***********/



var screenStrips = [];
var enemyscreenStrips = [];
function initScreen() {

var screen = $("screen");

for (var i=0;i<screenWidth;i+=stripWidth) {
var strip = dc("div");
strip.style.position = "absolute";
strip.style.left = i + "px";
strip.style.width = stripWidth+"px";
strip.style.height = "0px";
strip.style.overflow = "hidden";

strip.style.backgroundColor = "magenta";

var img = new Image();
img.src = (window.opera ? "walls_19color.png" : "walls.png");
img.style.position = "absolute";
img.style.left = "0px";

strip.appendChild(img);
strip.img = img; // assign the image to a property on the strip element so we have easy access to the image later

screenStrips.push(strip);
screen.appendChild(strip);




}

/*___________enemytest_________works but can't pass x y location____*/

var enemylocx=enemy.x;
var enemylocy=enemy.y;

var enemystrip = dc("div");
enemystrip.style.position = "absolute";
enemystrip.style.left = enemylocx + "px";
enemystrip.style.top = enemylocy + "px";
enemystrip.style.width = enemylocy+"px";
enemystrip.style.height = enemylocy+"px";
enemystrip.style.overflow = "hidden";

enemystrip.style.backgroundColor = "magenta";

var enemyimg = new Image();
enemyimg.src = (window.opera ? "walls_19color.png" : "walls.png");
enemyimg.style.position = "absolute";


enemystrip.appendChild(img);
enemystrip.img = enemyimg; // assign the image to a property on the strip element so we have easy access to the image later

enemyscreenStrips.push(enemystrip);
screen.appendChild(enemystrip);


}

/*__________enemy raycasting testing below_______*/
/*
function castRaysenemy() {

var enemystripIdx = 0;

for (var i=0;i<numRays;i++) {
// where on the screen does ray go through?
var rayScreenPos = (-numRays/2 + i) * stripWidth;

// the distance from the viewer to the enemy, simply Pythagoras.
var enemyrayViewDist = Math.sqrt((enemy.x-player.x)*(enemy.x-player.x)+ (enemy.y-player.y)*(enemy.y-player.y));

// the angle of the ray, relative to the viewing direction.
// right triangle: a = sin(A) * c
var rayAngle = Math.asin(rayScreenPos / enemyrayViewDist);
var enemylocx=enemy.x;
var enemylocy=enemy.y;

var enemystrip = dc("div");
enemystrip.style.position = "absolute";
enemystrip.style.left = enemylocx + "px";
enemystrip.style.top = enemylocy + "px";
enemystrip.style.width = enemylocy+"px";
enemystrip.style.height = enemylocy+"px";
enemystrip.style.overflow = "hidden";

enemystrip.style.backgroundColor = "magenta";

var enemyimg = new Image();
enemyimg.src = (window.opera ? "walls_19color.png" : "walls.png");
enemyimg.style.position = "absolute";


enemystrip.appendChild(img);
enemystrip.img = enemyimg; // assign the image to a property on the strip element so we have easy access to the image later

enemyscreenStrips.push(enemystrip);
screen.appendChild(enemystrip);



castSingleRay(
player.rot + rayAngle, // add the players viewing direction to get the angle in world space
enemystripIdx++);




}//end if
}
*/
/*_____enemy raycasting test end____________*/


function castRays() {

var stripIdx = 0;

for (var i=0;i<numRays;i++) {
// where on the screen does ray go through?
var rayScreenPos = (-numRays/2 + i) * stripWidth;

// the distance from the viewer to the point on the screen, simply Pythagoras.
var rayViewDist = Math.sqrt(rayScreenPos*rayScreenPos + viewDist*viewDist);

// the angle of the ray, relative to the viewing direction.
// right triangle: a = sin(A) * c
var rayAngle = Math.asin(rayScreenPos / rayViewDist);

castSingleRay(
player.rot + rayAngle, // add the players viewing direction to get the angle in world space
stripIdx++

);
}
}



function castSingleRay(rayAngle, stripIdx) {


// first make sure the angle is between 0 and 360 degrees
rayAngle %= twoPI;
if (rayAngle < 0) rayAngle += twoPI;

// moving right/left? up/down? Determined by which quadrant the angle is in.
var right = (rayAngle > twoPI * 0.75 || rayAngle < twoPI * 0.25);
var up = (rayAngle < 0 || rayAngle > Math.PI);

var wallType = 0;

// only do these once
var angleSin = Math.sin(rayAngle);
var angleCos = Math.cos(rayAngle);

var dist = 0; // the distance to the block we hit
var xHit = 0; // the x and y coord of where the ray hit the block
var yHit = 0;

var textureX; // the x-coord on the texture of the block, ie. what part of the texture are we going to render
var wallX; // the (x,y) map coords of the block
var wallY;

var wallIsHorizontal = false;

// first check against the vertical map/wall lines
// we do this by moving to the right or left edge of the block we're standing in
// and then moving in 1 map unit steps horizontally. The amount we have to move vertically
// is determined by the slope of the ray, which is simply defined as sin(angle) / cos(angle).

var slope = angleSin / angleCos; // the slope of the straight line made by the ray
var dXVer = right ? 1 : -1; // we move either 1 map unit to the left or right
var dYVer = dXVer * slope; // how much to move up or down

var x = right ? Math.ceil(player.x) : Math.floor(player.x); // starting horizontal position, at one of the edges of the current map block
var y = player.y + (x - player.x) * slope;
// starting vertical position. We add the small horizontal step we just made, multiplied by the slope.

while (x >= 0 && x < mapWidth && y >= 0 && y < mapHeight) {
var wallX = Math.floor(x + (right ? 0 : -1));
var wallY = Math.floor(y);

// is this point inside a wall block?
if (map[wallY][wallX] > 0) {
var distX = x - player.x;
var distY = y - player.y;
dist = distX*distX + distY*distY; // the distance from the player to this point, squared.

wallType = map[wallY][wallX]; // we'll remember the type of wall we hit for later
textureX = y % 1; // where exactly are we on the wall? textureX is the x coordinate on the texture that we'll use later when texturing the wall.
if (!right) textureX = 1 - textureX; // if we're looking to the left side of the map, the texture should be reversed

xHit = x; // save the coordinates of the hit. We only really use these to draw the rays on minimap.
yHit = y;

wallIsHorizontal = true;

break;
}
x += dXVer;
y += dYVer;
}



// now check against horizontal lines. It's basically the same, just "turned around".
// the only difference here is that once we hit a map block,
// we check if there we also found one in the earlier, vertical run. We'll know that if dist != 0.
// If so, we only register this hit if this distance is smaller.

var slope = angleCos / angleSin;
var dYHor = up ? -1 : 1;
var dXHor = dYHor * slope;
var y = up ? Math.floor(player.y) : Math.ceil(player.y);
var x = player.x + (y - player.y) * slope;

while (x >= 0 && x < mapWidth && y >= 0 && y < mapHeight) {



var wallY = Math.floor(y + (up ? -1 : 0));
var wallX = Math.floor(x);
if (map[wallY][wallX] > 0) {
var distX = x - player.x;
var distY = y - player.y;
var blockDist = distX*distX + distY*distY;
if (!dist || blockDist < dist) {
dist = blockDist;
xHit = x;
yHit = y;

wallType = map[wallY][wallX];
textureX = x % 1;
if (up) textureX = 1 - textureX;
}
break;
}
x += dXHor;
y += dYHor;

}




if (dist) {
//drawRay(xHit, yHit);

var strip = screenStrips[stripIdx];

dist = Math.sqrt(dist);

// use perpendicular distance to adjust for fish eye
// distorted_dist = correct_dist / cos(relative_angle_of_ray)
dist = dist * Math.cos(player.rot - rayAngle);

// now calc the position, height and width of the wall strip

// "real" wall height in the game world is 1 unit, the distance from the player to the screen is viewDist,
// thus the height on the screen is equal to wall_height_real * viewDist / dist

var height = Math.round(viewDist / dist);

// width is the same, but we have to stretch the texture to a factor of stripWidth to make it fill the strip correctly
var width = height * stripWidth;

// top placement is easy since everything is centered on the x-axis, so we simply move
// it half way down the screen and then half the wall height back up.
var top = Math.round((screenHeight - height) / 2);

strip.style.height = height+"px";
strip.style.top = top+"px";

strip.img.style.height = Math.floor(height * numTextures) + "px";
strip.img.style.width = Math.floor(width*2) +"px";
strip.img.style.top = -Math.floor(height * (wallType-1)) + "px";

var texX = Math.round(textureX*width);

if (texX > width - stripWidth)
texX = width - stripWidth;

strip.img.style.left = -texX + "px";



}




}

function drawRay(rayX, rayY) {
var miniMapObjects = $("minimapobjects");
var objectCtx = miniMapObjects.getContext("2d");

objectCtx.strokeStyle = "rgba(0,100,0,0.3)";
objectCtx.lineWidth = 0.5;
objectCtx.beginPath();
objectCtx.moveTo(player.x * miniMapScale, player.y * miniMapScale);
objectCtx.lineTo(
rayX * miniMapScale,
rayY * miniMapScale
);
objectCtx.closePath();
objectCtx.stroke();


}





/********reset boolean enemy fire***********/
function enemyfirefalse(){enemyfire=false;}

/********reset boolean player fire***********/

function firefalse(){playerfire=false;}

function gameCycle() {animate();move();updateMiniMap();castRays();setTimeout(gameCycle,gamespeed);}
function move() {
if ( Math.cos(enemy.rot)==Math.atan2(player.x,player.y)){enemy.rot=Math.atan2(player.x,player.y);enemyfire=true}
if (enemyfire==true){setTimeout("enemyfirefalse()",60)}
if (playerfire==true){setTimeout("firefalse()",60)}

var moveStep = player.speed * player.moveSpeed; // player will move this far along the current direction vector
player.rot += player.dir * player.rotSpeed * Math.PI / 180; // add rotation if player is rotating (player.dir != 0)
var newX = player.x + Math.cos(player.rot) * moveStep; // calculate new player position with simple trigonometry
var newY = player.y + Math.sin(player.rot) * moveStep;
if (isBlocking(newX, newY)) { // are we allowed to move to the new position?
return;}

var movebulletStep = playerbullet.speed * playerbullet.moveSpeed; // player will move this far along the current direction vector
playerbullet.rot += playerbullet.dir * playerbullet.rotSpeed * Math.PI / 180; // add rotation if player is rotating (player.dir != 0)
var newbulletX = playerbullet.x + Math.cos(player.rot) * movebulletStep; // calculate new player position with simple trigonometry
var newbulletY = playerbullet.y + Math.sin(player.rot) * movebulletStep;

var moveEnemyStep = enemy.speed * enemy.moveSpeed; // player will move this far along the current direction vector
enemy.rot += enemy.dir * enemy.rotSpeed * Math.PI / 180; // add rotation if player is rotating (player.dir != 0)
var newEnemyX = enemy.x + Math.cos(enemy.rot) * moveEnemyStep; // calculate new player position with simple trigonometry
var newEnemyY = enemy.y + Math.sin(enemy.rot) * moveEnemyStep;
if (isBlocking(newEnemyX, newEnemyY)) { // are we allowed to move to the new position?
return;}

var moveEnemybulletStep = enemybullet.speed * enemybullet.moveSpeed; // player will move this far along the current direction vector
enemybullet.rot += enemybullet.dir * enemybullet.rotSpeed * Math.PI / 180; // add rotation if player is rotating (player.dir != 0)
var newEnemybulletX = enemybullet.x + Math.cos(enemy.rot) * moveEnemybulletStep; // calculate new player position with simple trigonometry
var newEnemybulletY = enemybullet.y + Math.sin(enemy.rot) * moveEnemybulletStep;


player.x = newX; // set new position
player.y = newY;
playerbullet.x = newbulletX; // set new position
playerbullet.y = newbulletY;
enemy.x = newEnemyX; // set new position
enemy.y = newEnemyY;
enemybullet.x = newEnemybulletX; // set new position
enemybullet.y = newEnemybulletY;

/********player bullet firing***********/
if (playerfire==true){
playerbullet.x = player.x; // set new position
playerbullet.y = player.y;
newbulletX=player.x;
newbulletY=player.y
playerbullet.speed=3;
playerbullet.moveSpeed=0.68
}

/********enemy bullet firing***********/
if (enemyfire==true){
enemybullet.x = enemy.x; // set new position
enemybullet.y = enemy.y;
newEnemybulletX=enemy.x;
newEnemybulletY=enemy.y
enemybullet.speed=3;
enemybullet.moveSpeed=0.68
}
}/********end move()***************************************end move()*********************************************/
/********enemy position array***********/

enemyposition = new Array();
enemyposition = [[1,.18,0],[1,.18,1]];

/********enemy bullet array***********/

bulletpos =new Array();
bulletpos[0] = "0,0,0";

/********enemy animation*************/
var timer;
function animate(){
enemyMovementTimer+=1
if(enemyMovementTimer==100){
enemy.speed = parseInt(enemyposition[0][0]);
enemy.movespeed = parseInt(enemyposition[0]nt);
enemy.dir= parseInt(enemyposition[0]number2);

enemyMovementTimer-=100}//left turn
if(enemyMovementTimer>75){
enemy.speed = parseInt(enemypositionnt[0]);
enemy.movespeed = parseInt(enemypositionntnt);
enemy.dir= parseInt(enemypositionntnumber2);
}

return;
}




//end of sprtite movement test





function isBlocking(x,y)
{
// first make sure that we cannot move outside the boundaries of the level
if (y < 0 || y > mapHeight || x < 0 || x > mapWidth)

return true;
// return true if the map block is not 0, ie. if there is a blocking wall.
return (map[Math.floor(y)][Math.floor(x)] != 0);}

function updateMiniMap() {
document.getElementById("minimapobjects").width = document.getElementById("minimapobjects").width;
document.getElementById("minimapobjects").getContext("2d").fillRect(player.x * miniMapScale ,player.y * miniMapScale ,4,4);
document.getElementById("minimapobjects").getContext("2d").beginPath();
document.getElementById("minimapobjects").getContext("2d").moveTo(player.x * miniMapScale+2, player.y * miniMapScale+2);
document.getElementById("minimapobjects").getContext("2d").lineTo((player.x + Math.cos(player.rot) * 4) * miniMapScale,(player.y + Math.sin(player.rot) * 4) * miniMapScale);
document.getElementById("minimapobjects").getContext("2d").closePath();
document.getElementById("minimapobjects").getContext("2d").stroke();


//enemy test begins here //enemy test begins here

document.getElementById("minimapobjects").getContext("2d").moveTo(enemy.x * miniMapScale+2, enemy.y * miniMapScale);
document.getElementById("minimapobjects").getContext("2d").fillRect(enemy.x * miniMapScale ,enemy.y * miniMapScale ,4,4);
document.getElementById("minimapobjects").getContext("2d").beginPath();
document.getElementById("minimapobjects").getContext("2d").moveTo(enemy.x * miniMapScale+2, enemy.y * miniMapScale+2);
document.getElementById("minimapobjects").getContext("2d").lineTo((enemy.x + Math.cos(enemy.rot) * 4) * miniMapScale,(enemy.y + Math.sin(enemy.rot) * 4) * miniMapScale);
document.getElementById("minimapobjects").getContext("2d").closePath();
document.getElementById("minimapobjects").getContext("2d").stroke();

//bullet test begins here
document.getElementById("minimapobjects").getContext("2d").beginPath();

document.getElementById("minimapobjects").getContext("2d").moveTo(playerbullet.x * miniMapScale, playerbullet.y * miniMapScale+2);
document.getElementById("minimapobjects").getContext("2d").fillRect(playerbullet.x * miniMapScale ,playerbullet.y * miniMapScale+2 ,3,1);
document.getElementById("minimapobjects").getContext("2d").closePath();

document.getElementById("minimapobjects").getContext("2d").beginPath();
document.getElementById("minimapobjects").getContext("2d").moveTo(enemybullet.x * miniMapScale, enemybullet.y * miniMapScale+2);
document.getElementById("minimapobjects").getContext("2d").fillRect(enemybullet.x * miniMapScale ,enemybullet.y * miniMapScale+2 ,3,1);
document.getElementById("minimapobjects").getContext("2d").closePath();

}
function drawMiniMap() {
document.getElementById("minimap").width = mapWidth * miniMapScale;
document.getElementById("minimap").height = mapHeight * miniMapScale;
document.getElementById("minimapobjects").width = document.getElementById("minimap").width;
document.getElementById("minimapobjects").height = document.getElementById("minimap").height;
var w = (mapWidth * miniMapScale) + "px"
var h = (mapHeight * miniMapScale) + "px"
document.getElementById("minimap").style.width = document.getElementById("minimapobjects").style.width
document.getElementById("minimap").style.height = document.getElementById("minimapobjects").style.height
document.getElementById("minimap").getContext("2d").fillStyle = "white";
document.getElementById("minimap").getContext("2d").fillRect(0,0,document.getElementById("minimap").width,document.getElementById("minimap").height);
// loop through all blocks on the map
for (var y=0;y<mapHeight;y++) {
for (var x=0;x<mapWidth;x++) {
var isAwall = map[y][x];//
if (isAwall > 0) {
//block at this (x,y) ...map[y][x] We got a wall!!


document.getElementById("minimap").getContext("2d").fillStyle = "rgb(200,200,200)";
document.getElementById("minimap").getContext("2d").fillRect(x * miniMapScale,y * miniMapScale,miniMapScale,miniMapScale);


}}}
updateMiniMap();}
setTimeout(init, 1);
function bindKeys() {
document.onkeydown = function(e){
e = e || window.event;switch (e.keyCode) {
case 38: // forward
player.speed = 1;break;
case 40: // backward
player.speed = -1;break;
case 37: // left
player.dir = -1;break;
case 39: // right
player.dir = 1;break;
case 32: playerfire=true;
break}} //0 stop player when key is released
document.onkeyup = function(e) {e = e || window.event;switch (e.keyCode)
{case 38:case 40layer.speed = 0;break;case 37:case 39layer.dir = 0;break;}}}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],
[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
];

</script>
</body>

coach
Nervous Wreck (II) Inmate

From:
Insane since: May 2011

posted posted 05-31-2011 11:10
Edit TP: spam removed


Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu