Incorporate squish offset
parent
cd263f0dd5
commit
0a3fefb194
|
@ -1,4 +1,4 @@
|
|||
Make*
|
||||
.vscode
|
||||
main
|
||||
main.code-workspace
|
||||
*
|
||||
!*.c
|
||||
!*.h
|
||||
!.gitignore
|
5
main.c
5
main.c
|
@ -38,7 +38,7 @@ int main()
|
|||
camera.rotation = 0.0f;
|
||||
camera.zoom = 1.0f;
|
||||
|
||||
struct kinematic_obj player = init_kinematic_obj(30, 30);
|
||||
struct kinematic_obj player = init_kinematic_obj(40, 40);
|
||||
player.color = BLUE;
|
||||
struct kinematic_obj tile = init_kinematic_obj(900, 100);
|
||||
set_position(&player, 400, 300);
|
||||
|
@ -92,8 +92,7 @@ int main()
|
|||
DrawRectangleRec(current->obj->rect, current->obj->color);
|
||||
current = current->next;
|
||||
}
|
||||
DrawTriangle((Vector2){0,0},
|
||||
(Vector2){screenWidth, screenHeight}, (Vector2){50,0}, BLACK);
|
||||
DrawFPS(100,100);
|
||||
draw_squishy(&sqr);
|
||||
EndMode2D();
|
||||
|
||||
|
|
|
@ -33,13 +33,13 @@ void update_squishy(struct squishy_square *square){
|
|||
square->bottomright.y = square->rect->y + square->rect->height;
|
||||
|
||||
square->top_handle.x = square->rect->x + square->rect->width / 2;
|
||||
square->top_handle.y = square->rect->y;
|
||||
square->top_handle.y = square->rect->y + square->top_offset;
|
||||
square->bottom_handle.x = square->rect->x + square->rect->width / 2;
|
||||
square->bottom_handle.y = square->rect->y + square->rect->height;
|
||||
square->left_handle.x = square->rect->x;
|
||||
square->bottom_handle.y = square->rect->y + square->rect->height - square->bottom_offset;
|
||||
square->left_handle.x = square->rect->x + square->left_offset;
|
||||
square->left_handle.y = square->rect->y + square->rect->height / 2;
|
||||
square->right_handle.x = square->rect->x + square->rect->width;
|
||||
square->right_handle.y = square->rect->y+ square->rect->height / 2;
|
||||
square->right_handle.x = square->rect->x + square->rect->width - square->right_offset;
|
||||
square->right_handle.y = square->rect->y+ square->rect->height / 2;
|
||||
}
|
||||
|
||||
void draw_squishy(struct squishy_square *square){
|
||||
|
|
Loading…
Reference in New Issue