Jump to content
• Advertisement

# jcrapsey

Member

11

## Posts posted by jcrapsey

1. ### Storing Tilebased Maps in a PNG file. Any ideas?

Great topic, I have been thinking about this for a while now. Have you every heard of gif stockets? https://github.com/videlalvaro/gifsockets
2. ### Html5 Isometric engines

The only engine that comes to mind is the Isogenic Engine.
http://www.isogenicengine.com/

Also I have been working on a few myself.

http://dl.dropbox.com/u/137743/Development/Projects/iso_dream_painter/static/index.html
and
http://dl.dropbox.com/u/137743/Development/Projects/sprite3d_experiments/static/character_sprite.html
3. ### Missile Vector Calculation

I was banging my head on the wall over this problem for a while yesterday. And now it makes so much sense! Thank you so much for your help.

my newest version is here.

The position of the red square is so perfect now!
4. ### Missile Vector Calculation

Tiblanc I came up with that exact algorithm, but there is a problem with it (maybe I'm not understanding it completely). When I use that to process the x,y mouse position to 3D, then that 3d position is rendered back to a 2D position in order for it to be visually represented. The Y value is always half of what the position should be, other than that it would be perfect.

Example:
mousePos = {'x':10,'y':20};
new3D = get3D(mousePos.X,mousePos.Y);
new2D = get2D(new3D.X,new3D.Y,new3D.Z);
//This will be my new result
new2D = {'x':10,'y':10};
I am guessing this is because of the multiplication from the first algorithm y' = (1/2)*(x + z) + y.

If you would like to see it visually you can check out an example here.
The red box represents where the mouse is in 3D space (so I think).
5. ### Missile Vector Calculation

Tiblanc thank you so much for pointing me in the right direction. I have since changed my code to store / manipulate 3D coordinantes. I use a simple algorithm that I found on this forum in order to translate or "project" this data into 2D coordinates that will then render on the screen. Using this algorithm I have reduced all the math in my code to nothing, and the accuracy of my positioning is perfect!

Algorithm that I use is:

x' = (x - z);
y' = (1/2)*(x + z) + y;

My updated project is here.

This has produced another problem for me. I would like to get the angle of the users sprite based on the mouse's position in the theoretical 3D space. Is there a way to get 3D position based on the 2D position (with a fixed z) of the mouse? I am using javascript for my logic, but if you have an example in another language or just an idea of how that problem is solved that would be greatly appreciated.
6. ### Missile Vector Calculation

Okay after a little research I started using Math.atan2() in javascript to calculate the angle between my box and my mouse. I added a visual aid in order to see the angle my calculation was producing. It seems really close at 3 different points in the rotation, but it's not perfect. Can anyone tell me if this is the way I should go about this. My plan is to animate a missile away from the box towards the direction from the mouse.

Here is a snapshot of my work here

My code that matters is pretty much this.

var mousePos = {x:0,y:0},
boxPos = {x:0,y:0}

//this is where I calculate the angle based on the box's position and my mouse position;
radians = Math.atan2((mousePos.y) - boxPos.y,mousePos.x - boxPos.x);

//this gives the marker it's position around my box to visually show the angle
myMarker.css({ top:Math.sin(radians)*50+boxPos.y , left:Math.cos(radians)*100+boxPos.x });
7. ### Missile Vector Calculation

Okay here is my problem, I have been working on a small little project for a while now and I would to love to add some violence to my little isometric experiment. I wasn't sure if I should have posted this into Web Development or here, but I think for my specific problem here was the better choice.

So far I only got W,A,S,D movement so you can go ahead and try that out here.

But I would like that red box to fire a missile every time the user clicks the left mouse button. Does anyone here have any advice, resources or just some tips? I have been doing web development for a while and this is my first attempt at a game so I am just trying to wrap my head around how games are developed.
8. ### [web] HTML5 canvas problem

Maybe an example of your work / code will help me understand a little better, but

Have you tried making the parent container position relative and the canvas position absolute then you could position the canvas directly with CSS (left:10px/top:10px;) + Javascript ?
9. ### [web] Moving object with Javascript

If you are using jquery maybe you can find what you are looking for here http://jsfiddle.net/7TEsF/1/

but if I am understanding you correctly are you are trying to use setTimeout() in order to do animations?

If so you might want to make it into a setTimeout loop and increment your animation accordingly

http://jsfiddle.net/DgXuS/

var pos = 0;
(function tick(){
pos++;
[color=#1C2837][font=CourierNew, monospace][size=2][color=#660066]Obj[/font][color=#1C2837][font=CourierNew, monospace][size=2][color=#666600].[/font][color=#1C2837][font=CourierNew, monospace][size=2][color=#000000]style[/font][color=#1C2837][font=CourierNew, monospace][size=2][color=#666600].[/font][color=#1C2837][font=CourierNew, monospace][size=2][color=#000000]marginRight[/font][color=#1C2837][font=CourierNew, monospace][size=2][color=#666600]= pos + [/font][color=#1C2837][font=CourierNew, monospace][size=2][color=#008800]'px'[/font][color=#1C2837][font=CourierNew, monospace][size=2][color=#666600];[/font]
if(pos < 360){
setTimeout(tick,1000/60);
}
}());
10. ### [web] How to start making a Browser Game?

If you are thinking about building a browser based game you might want to consider studying Html CSS and javascript. Some people that are more accustomed to classical type languages (C++/Java) might scoff at the idea of building a game engine with these technologies, but Since the Release of chrome with the V8 engine, javascript has been performing a lot faster. Also you might want to consider server side javascript with node.js so you can do all your programming with one language. With Node you can do use libraries like socket.io in order to keep a constant connection between the server and the client. If you want an example of what I am talking about check out the aves web game engine ( http://www.youtube.c...h?v=Ol3qQ4CEUTo ).
• Advertisement
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!