Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

2
Help with calculating position & collisions for Isometric game
Post Flair (click to view more posts with a particular flair)
Post Body

Hello all,

I'm currently making an isometric game using tiles based off of Shaun Spalding's isometric game rendering tutorial. I have the system down, I just can't seem to find a good way to handle collisions. It seems that any object I place into the room goes wherever it feels like. With an adjustment of 1 pixel throwing the object across the room.

Here is the macros script:

function macros(){
    #macro MAP_W 64
    #macro MAP_H 120
    #macro TILE_W 32
    #macro TILE_H 16
    #macro SCREEN_W 1024
    #macro SCREEN_H 1920

    enum TILE{
        SPRITE = 0,
        Z = 1
    }
}

Here is the ScreenToTileX and ScreenToTileY script:

function ScreenToTileX(){
    var _screenX = argument0 - (SCREEN_W * 0.5);
    var _screenY = argument1 - (SCREEN_H * 0.25);
    return floor((_screenX / (TILE_W * 0.5)   _screenY / (TILE_H * 0.5) ) * 0.5);
}

function ScreenToTileY(){
    var _screenX = argument0 - (SCREEN_W * 0.5);
    var _screenY = argument1 - (SCREEN_H * 0.25);
    return floor((_screenY / (TILE_H * 0.5) - (_screenX / (TILE_W * 0.5)))*0.5);
}

Here is the TileToScreenX and TileToScreenY script:

function TileToScreenX(){
    var _tX = argument0;
    var _tY = argument1;
    return ((_tX - _tY) * (TILE_W * 0.5))   (SCREEN_W * 0.5);

}


function TileToScreenY(){
    var _tX = argument0;
    var _tY = argument1;
    return ((_tX   _tY) * (TILE_H * 0.5))   (SCREEN_H * 0.25);

}

Any help in just understanding how I would program like collisions and stuff would be greatly appreciated, thank you!

Author
Account Strength
50%
Account Age
4 years
Verified Email
No
Verified Flair
No
Total Karma
107
Link Karma
90
Comment Karma
17
Profile updated: 11 hours ago
Posts updated: 2 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
1 year ago