1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use crate::collision;
use crate::core;
use crate::loader::map;
//const Gdrag: i64 = 1;

pub fn render_physics(screen: &mut core::Screen, physobj: Vec<i64>, G: i64) {
    // since acore and bcore use diffrent screens i have to do it this way
    let map = screen.gmap();
    let phsob = physobj;
    screen.load_map(renderphys(map, phsob, G));
}

fn renderphys(screen: map, physobj: Vec<i64>, g_drag: i64) -> map {
    let mut mp = map {
        chars: screen.chars,
        x: screen.x,
        y: screen.y,
    };

    for i in physobj {
        // just adds physics to all objects
        for _ in 0..g_drag {
            mp.y[i as usize] += 1;
            if collision::get_collision(i as usize, &mut mp) {
                mp.y[i as usize] -= 1;
            }
        }
    }
    mp
}