Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback #1

Open
wants to merge 105 commits into
base: feedback
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
6997179
Setting up GitHub Classroom Feedback
github-classroom[bot] Mar 14, 2024
3805943
first upload
SKetchPoint Mar 14, 2024
a6c4110
create ReadMe file
SKetchPoint Mar 14, 2024
a28518a
notes on brief
SKetchPoint Mar 14, 2024
4d71621
Update README.md
SKetchPoint Mar 18, 2024
2b81e21
Update 2 README.md
SKetchPoint Mar 19, 2024
1402fe0
Update #3 README.md
SKetchPoint Mar 19, 2024
7e356e0
Update README.md
SKetchPoint Mar 19, 2024
9e8355e
Update README.md
SKetchPoint Mar 19, 2024
3213112
Update README.md
SKetchPoint Mar 20, 2024
785a075
Update README.md
SKetchPoint Apr 16, 2024
e0aa6b7
Update README.md
SKetchPoint Apr 16, 2024
9ee3e70
Struggling to get NGL up
SKetchPoint Apr 16, 2024
7936702
Update README.md
SKetchPoint Apr 16, 2024
634ba40
Update README.md
SKetchPoint Apr 16, 2024
afe97a6
fix pushing of ReadMe
SKetchPoint Apr 17, 2024
00afc24
Update README.md
SKetchPoint Apr 17, 2024
398c714
Update README.md
SKetchPoint Apr 17, 2024
9aeb769
Update README.md
SKetchPoint Apr 17, 2024
e3f3a34
Update README.md
SKetchPoint Apr 17, 2024
f187471
Update README.md
SKetchPoint Apr 17, 2024
36e805a
Class and Structure ReadMe
SKetchPoint Apr 25, 2024
0ee9bbf
Class and Structure ReadMe
SKetchPoint Apr 25, 2024
d56b6dc
Class and Structure ReadMe
SKetchPoint Apr 25, 2024
69bfc6d
display changed ReadMe
SKetchPoint Apr 25, 2024
fd6ae5e
Directory Struct ReadMe plan
SKetchPoint Apr 26, 2024
a8796e2
Background Reserch ReadMe Update+ cutdown
SKetchPoint Apr 26, 2024
f8cce1a
Background Reserch ReadMe Update
SKetchPoint Apr 26, 2024
c79a370
Game PRogramming Patterns ReadMe Update
SKetchPoint Apr 30, 2024
1749a09
UpdateTest
SKetchPoint Apr 30, 2024
ed2d684
Cleanup, mouse ctrl kept
SKetchPoint Apr 30, 2024
f8847ce
plane inserted
SKetchPoint Apr 30, 2024
80f2f61
Note Issue w shaders
SKetchPoint Apr 30, 2024
251368d
folder in folder
SKetchPoint Apr 30, 2024
767a357
NGL scene basic shapes
SKetchPoint May 1, 2024
ed363c5
Color Change+Cone.h
SKetchPoint May 1, 2024
947e352
Initial Block and Cone .h and .cpp
SKetchPoint May 2, 2024
388f15b
game box build, timer event game
SKetchPoint May 9, 2024
5814ffc
updating game mech
SKetchPoint May 9, 2024
ceeee3a
refactor cone, fix color w/o new shader
SKetchPoint May 10, 2024
c253854
WSAD + QEZX cone controlls
SKetchPoint May 10, 2024
7406dfe
keyboard cone controlls
SKetchPoint May 10, 2024
790c020
collision issue Readme
SKetchPoint May 10, 2024
baf153e
collision issue img Readme
SKetchPoint May 10, 2024
b9faa42
collision issue Readme
SKetchPoint May 10, 2024
7c43e95
scoops draw
SKetchPoint May 10, 2024
3fd332e
block update
SKetchPoint May 10, 2024
504a6f3
GJK collision alg
SKetchPoint May 11, 2024
afd2b9f
GJK collision pt2
SKetchPoint May 11, 2024
6da1209
GJK collision pt3
SKetchPoint May 11, 2024
85d0dc4
GJK collision pt4
SKetchPoint May 11, 2024
0929c53
cone update collision
SKetchPoint May 11, 2024
97530c6
cone update collision
SKetchPoint May 11, 2024
94d13bc
patch cubenot showing
SKetchPoint May 11, 2024
0376ee7
Switched to AABB collision, works TuT
SKetchPoint May 12, 2024
ef48db7
AABB collision + ReadMe Controlls recorder
SKetchPoint May 12, 2024
2dc9a84
add to Readme
SKetchPoint May 12, 2024
5456b6a
tidying + display points and lives on title
SKetchPoint May 12, 2024
d2b0b57
Readme Format
SKetchPoint May 12, 2024
85b0dad
Readme Format
SKetchPoint May 12, 2024
7236013
Readme Format
SKetchPoint May 12, 2024
930d43e
Readme Format
SKetchPoint May 12, 2024
795f7ae
Readme Format
SKetchPoint May 12, 2024
e11d5e5
Fix point/live issue
SKetchPoint May 12, 2024
7ea478a
Backup
SKetchPoint May 12, 2024
3de33ad
generation test
SKetchPoint May 12, 2024
9c809ce
generation test
SKetchPoint May 12, 2024
252710b
ReadMe thoughts
SKetchPoint May 12, 2024
6658af8
ReadMe thoughts
SKetchPoint May 13, 2024
22ba99a
ReadMe thoughts
SKetchPoint May 13, 2024
84f43bf
ReadMe thoughts
SKetchPoint May 13, 2024
edc3ad1
Cone Movement settings 2 types
SKetchPoint May 13, 2024
a4cfc93
Read Me Update
SKetchPoint May 13, 2024
05f4dc5
Playable Game
SKetchPoint May 13, 2024
7fbdf66
Playable Game
SKetchPoint May 13, 2024
0379e75
Demo video v 1
SKetchPoint May 13, 2024
4aeab8b
Location of video files
SKetchPoint May 13, 2024
9b57ef5
s
SKetchPoint May 14, 2024
2c26cae
set up buttons
SKetchPoint May 14, 2024
e115caf
Read Me instructions
SKetchPoint May 14, 2024
832b4eb
Read Me instructions
SKetchPoint May 14, 2024
d9bb231
Read Me instructions
SKetchPoint May 14, 2024
30e995a
Read Me instructions
SKetchPoint May 14, 2024
dc7497c
Button Test hookup
SKetchPoint May 14, 2024
282e17f
Button Controlls switch
SKetchPoint May 14, 2024
4166c9c
Button Reset
SKetchPoint May 14, 2024
4e48eea
Button Pause
SKetchPoint May 14, 2024
184d736
Read Me Update
SKetchPoint May 14, 2024
74eb3b5
Read Me Update
SKetchPoint May 14, 2024
67aa0aa
Read Me Update
SKetchPoint May 14, 2024
d017df4
helper functions
SKetchPoint May 15, 2024
11978f1
bug fix
SKetchPoint May 15, 2024
cc5fead
cone changes with type hit
SKetchPoint May 15, 2024
fd7a878
deletes block if it's not alive
SKetchPoint May 15, 2024
e0f0f26
deletes block if it's not alive
SKetchPoint May 15, 2024
815e43e
read me instructions
SKetchPoint May 15, 2024
7712983
ice cream button instructions
SKetchPoint May 15, 2024
a2637ab
ice cream button instructions
SKetchPoint May 15, 2024
3829c90
v2 videos
SKetchPoint May 15, 2024
6f82ca8
video full
SKetchPoint May 16, 2024
b8e5c7f
vid inside README.md
SKetchPoint May 16, 2024
89dee41
Update README.md
SKetchPoint May 16, 2024
0271ae5
QGui to Qapplication, prevent segmentation
SKetchPoint May 20, 2024
60b97c4
QGui to Qapplication, prevent segmentation
SKetchPoint May 20, 2024
48a3050
video full
SKetchPoint May 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea
cmake-build*
build
60 changes: 60 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
cmake_minimum_required(VERSION 3.12)
#-------------------------------------------------------------------------------------------
# I'm going to use vcpk in most cases for our install of 3rd party libs
# this is going to check the environment variable for CMAKE_TOOLCHAIN_FILE and this must point to where
# vcpkg.cmake is in the University this is set in your .bash_profile to
# export CMAKE_TOOLCHAIN_FILE=/public/devel/2020/vcpkg/scripts/buildsystems/vcpkg.cmake
# to build see the NGL instructions
# Windows :- mkdir build; cd build ; cmake -DCMAKE_PREFIX_PATH=~/NGL/ .. ; cmake --build .
# Linux / Mac mkdir build; cd build; cmake -DCMAKE_PREFIX_PATH~/NGL/ .. ; make
#-------------------------------------------------------------------------------------------
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND DEFINED ENV{CMAKE_TOOLCHAIN_FILE})
set(CMAKE_TOOLCHAIN_FILE $ENV{CMAKE_TOOLCHAIN_FILE})
endif()

# Name of the project
project(ParticleNGL)
# This is the name of the Exe change this and it will change everywhere
set(TargetName ParticleNGL)
# This will include the file NGLConfig.cmake, you need to add the location to this either using
# -DCMAKE_PREFIX_PATH=~/NGL or as a system environment variable.
find_package(NGL CONFIG REQUIRED)
# Instruct CMake to run moc automatically when needed (Qt projects only)
set(CMAKE_AUTOMOC ON)
# find Qt libs
# find Qt libs first we check for Version 6
find_package(Qt6 COMPONENTS OpenGL Widgets QUIET )
if ( Qt6_FOUND )
message("Found Qt6 Using that")
else()
message("Found Qt5 Using that")
find_package(Qt5 COMPONENTS OpenGL Widgets REQUIRED)
endif()

# use C++ 17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)
# Set the name of the executable we want to build
add_executable(${TargetName}
include/Cone.h
include/Block.h
src/Block.cpp
src/Cone.cpp
)

# Add NGL include path
include_directories(include $ENV{HOME}/NGL/include)
target_sources(${TargetName} PRIVATE ${PROJECT_SOURCE_DIR}/src/main.cpp
${PROJECT_SOURCE_DIR}/src/NGLScene.cpp
${PROJECT_SOURCE_DIR}/src/NGLSceneMouseControls.cpp
${PROJECT_SOURCE_DIR}/include/NGLScene.h
)

target_link_libraries(${TargetName} PRIVATE Qt::Widgets Qt::OpenGL NGL)

add_custom_target(${TargetName}CopyShaders ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/shaders
$<TARGET_FILE_DIR:${TargetName}>/shaders
)
126 changes: 126 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
Savannah Kreider s5501023 CFGAA Assignment

# Assignment Ideas/Work Doc : 3D scoops game
- ----------------------------------------------------------------------------------------------------------------------------------------------
## Video:(Itterations in Video-Tests folder)
[V3-gamePlayFull.webm](https://github.com/NCCA/cfgaa24programingassignment-SKetchPoint/assets/124518080/d9803373-649d-4e06-a336-44a88256c065)

---------------------------------------------------------------------------------------------------------------------------
- Gameplay Controlls:
- wsad key controlls to go in xz coordnates
- qezx key controlls to go diagonally in xz coordnates
- key 1 to reset viewport, key 2 for control type direct, key 3 for control type continual movement, key 4 to pause/resume game
- left mouse button to rotate around scene, right mouse button to move scene up, down, left, or right
- when player runs out of lives, the scene resets
-
- Button Menu:
- [[ | | ]]- pause game/ resume game
- [Controlls]- swithc between the two type of controlls over the cone (continual or direct)
- [Reset]- resets the entire game, including stats
-------------------------------------------------------------------------------------------------------------------
- Requires BRFORE build:
- c++ compiler supporting C++17, Qt5 (or) Qt6, NGL (NCCA Graphics Library),and vcpkg
-
- Building- make sure that you have CMakeLists.txt file, type into terminal:
- mkdir build
- cd build
- cmake ..
- make
-
- OR in your terminal:
- clion .
- (in CLion have CMakeLists.txt, ParticleNGL and build ParticleNGLCopy Shaders)
-----------------------------------------------------------------------------------------------------------------------------------------
## Design of classes/structures:
- Block.cpp- stores type, if the falling block is alive, initial speed, position, movement over change in time, point value, drawing the block
- Cone.cpp- stores lives, player points, speed of controlled cone, updating score and lives, distance between vectors to aid in collision checking, modifying states and values based on collision, drawing out the user controlled item
- main.cpp- creating the playable window, another window for button settings, and continually playing till user closes
- NGLScene.cpp- drawing the entire scene, setting up shader, timers for game play, true collision changes of updating the cone based on collided scoop and ending the scoop, key controlled cone, generation of falling scoops, and game loop via time event
- NGLSceneMouseControls.cpp- allowing rotation of the scene through left and right clicks of the mouse
## Directory Structure:
- src: main.cpp, NGLScene.cpp, NGLSceneMouseControls.cpp, Block.cpp, Cone.pp
- include:main.h, NGLScene.h , Block.h ,Cone.h
- CMakeList.txt
- .github (and .gitignore)
- README.md
- -----------------------------------------------------------------------------------------

## Annotated Bibliography:
----------------------------------------------------------------------------------------------------
- Scoops (2008)by NimbleBit:
- MobyGames. (n.d.). Scoops (2008). [online] Available at: https://www.mobygames.com/game/49407/scoops/.
-
- Originally, the game that I had in mind to expand upon was Scoops. You tilt your phone side to side to move the cone back and forth on the screen in doing so avoiding trash but collecting scoops to build the tower up. - - However, making it 3D means moving up the orthographic camera isnt as viable for a perspective as eventually it becomes too tiny to see everything properly either the board and/or the falling objects. So trying to come up with a more creative workaround to implement a game to this. While it does give me a basis as to powerups being special scoops, trash to avoid taking a life, and stackable scoops that earn point, it requires modification to be changed to 3D on a computer. Having controlls be on a common wsad movement, allowing to use the mouse to rotate around the enviroment, and trying to see how I can still collect without running into visual issues with the game is what I need to further explore.
- Overall, this game gives me the basic framework of my game, its general rules that I can then compare to similar games like this one , and add on my own solutions to the issues mentioned.
-
- Game Programming Patterns:
- Gameprogrammingpatterns.com. (2014). Game Loop · Sequencing Patterns · Game Programming Patterns. [online] Available at: https://gameprogrammingpatterns.com/game-loop.html.
-
- Having the stucture of:
- while (true)
{
processInput();//all user inputs from last update
update();//updating the game
render();//renders to screen as frame
sleep(start + MS_PER_FRAME - getCurrentTime());//delay render
}
- will allow me to have user inputs handled since the last call, updates it visuall, then renders it on the screen. The game loop will run continuously and can be used to control the rate of gameplay. However, Robert Nystrom mentions two things is to control that th game dosen't run too fast if it processes fames too quicky and to not force patterns. While a game loop will be benificial, fps also needs to account for thus a sleep function ise useful. However, its fails to consider what happens if the computer can't handle the calculations thus revising to account for lag as well to catch up with the player:
- double previous = getCurrentTime();
double lag = 0.0;//ensures catch up of multipe updates occures gradually over time making for a smoother gameplay
//MS_PER_UPDATE-consistent rate indepentent of system performance
- while (true)
{
double current = getCurrentTime();
double elapsed = current - previous;
previous = current;
lag += elapsed;

processInput();

while (lag >= MS_PER_UPDATE)
{
update();
lag -= MS_PER_UPDATE;
}

render(lag / MS_PER_UPDATE);
}

- Jon's Teapot: Getting Started with the Programming Assignment The SpaceShip
- Jon Macey (2012). Jon’s Teapot: Getting Started with the Programming Assignment Pt 4 The SpaceShip. [online] Jon’s Teapot. Available at: http://jonmacey.blogspot.com/2012/02/getting-started-with-programming_8527.html
-
- Taking a look at how someone that has handle keys in NGL and overall game loops, there's a few things that I need to implement such as processing holding a key down consistently to continually move by processing the key pressed in the object you want to move and draw it in the paintGL with a game loop.
- A common rounding error for calculating where the boundaries of the block (if an actual block is used) is a rounding error on the cone opsition and the block distance, where the calculated error is clipped as the distance is in a sphere shape for catchDistance and distance = (cone position - block position ) length it would calc in a sphere shape instead of the actual geometry of a block
- anything outside of the sphere would read as if it didn't collide with the block unless further calculations are made
!["block with distance from center, collision in shape of sphere"](images/IllustrateCatchError.png)
- Initially I had attempted to do a GJK collision algorithm, however because I continually got computational errors in my version trying to account for the cone and the initial scoop. However, due to there being an initial scoop on top and only needing to account for a box, I adjusted to go to the Anti Aliasing Bounding Box(AABB)
- MDN Web Docs. (n.d.). 3D collision detection. [online] Available at: https://developer.mozilla.org/en-US/docs/Games/Techniques/3D_collision_detection.
- MDN explains that the AABB is the quickest algorithm to detect whether two game entities are overlapping or not which is important for a game with real-time rendering (or as close as possible) and it covers 3 different types, point, sphere, and box type collisions
- Once completing this, I realized creating an emitter class for the scoops above the playable area would be the most efficient way of handling the generation of the falling Blocks to generate above the same area of the valid play box while only changing the y
- However, instead of directly using an emitter, I use a generateRandom scoop to generate a scoop every x time and put it into a list. Once the scoops move based on time downward then I can implement removing scoops that hit the floor ir collide, change points/lives depending on if they were supposed to catch or avoid
- Noticing the irregularities in speed when holding down buttons, I attempted to do a lerp on the cone movement and found out having a continually moving cove vs strictly user controlled crated two different types of game play for the user to balance.
- Due to the sizing of the scoops and the limitations of seeing the scene till about they 10.0f at y, I opted to have the scoop collect as opposed to stacking in 3D for fear of the player losing the cone scoop and control. Thus, I decided to modify from the inspired game with a similar game that also catches fallen objects
- Inorder to get UI for the buttons and other functions, I utilized QT documentation(https://doc.qt.io/) for things like windows, buttons and other UI features
----------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------

## Initial Research

- Sky Burger (2009) by NimbelBit:
- Wikipedia. (2023). Sky Burger. [online] Available at: https://en.wikipedia.org/wiki/Sky_Burger.
-
- Sky Burger's unique implementation of this style of game was that there were certain ingredients and certain amounts of ingredients that you needed to collect and then top off with a bun in order to complete the order, the closer you were to the correct order,the larger the 'tip' was. Using the money you could unlock other items, themes, and levels. While in the scope of this project I won't be going as robust as that,again its a way if I have time to expand upon my project in a challenging way for the game play. I could implement ingredents/challeges of what to collect or a casual mode.
-
- Tower Bloxx (2007) by Digital Chocolate:
-PeakD. (n.d.). Tower Bloxx Deluxe - Perfect for Stress. [online] Available at: https://peakd.com/hive-140217/@musicandreview/tower-bloxx-deluxe-perfect-for-stress.
-
- Unlike the prior 3 game I've looked at, this one has the controlls above as you try to aim below to accurately build a tower as centered as you can. This one is also in 3D instead of 2D, so certian things in gameplay could be more useful as to how they solved certian issies. It adusts the camera height with each block placed so that when you're aiming it continues to swing side to side, adding to the difficulty of placing the block ontop. It is non rotatable cameraview, in more of a front view. Playing in this manner for a catching game instead of a aming game would be challenging. However things such as having a finite goal till it ends may be one way to stop a player going out of bounds of the game that it was reasonably built to. It also explores the effect that having aiming could affect the game play, perfect no swing and everything else would increase the swaying. I could implement a jitter as you're 'balancing' to create this effect if I dont visually see the stack change past a certian number if its on the floor
-
- The My Little Pony Gameloft Wiki. (n.d.). Apple-Picking. [online] Available at: https://mlp-gameloft.fandom.com/wiki/Apple-Picking [Accessed 13 May 2024].
- Going in a similar game, in the mini game Apple-Picking, similarly to Scoops, you have to avoid the rotten apples, and catch as many ripe apples as you can in a time limit to get more coins. Green apples equal 100 coins, Red apples equal 1000 coins and rainbow colored (Zap) apples are 5 gems. This inspired me to put a time limit on my own game and expand upon what was given to the player as I continue to develop the concept for my 3D version of Scoops slightly modified
- Patterns in C- Part 2:State :
- Peatersen, A. (n.d.). Patterns In C - Part 2: STATE. [online] Available at: https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=https://www.adamtornhill.com/Patterns%2520in%2520C%25202,%2520STATE.pdf&ved=2ahUKEwjilNbAveCFAxVgXEEAHXbIAYUQFnoECBIQAQ&usg=AOvVaw214ZWxK1HMAcGCyseQ0b7i.
- Patterns in C- Part 4 :Observer:
- Peatersen, A. (n.d.). Patterns In C - Part 4: OBSERVER. [online] Available at:https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=https://www.adamtornhill.com/Patterns%2520in%2520C%25204,%2520OBSERVER.pdf&ved=2ahUKEwjpkcDnveCFAxVSS0EAHYC9AcAQFnoECBYQAQ&usg=AOvVaw2TBLtvxukUpHV0Czg4XXXw
- Basing my game off of the two patterns State and Observer for things such as the menu, player event inorder to reduce complexity while building flexibility in the game's development, while state is used for collisions of the blocks and user inputs
------------------------------------------------------------------------------------------------------------------------------------
Binary file added Video-Tests/V3-gamePlayl.webm
Binary file not shown.
Binary file added Video-Tests/v1.webm
Binary file not shown.
Binary file added Video-Tests/v2-controls.webm
Binary file not shown.
Binary file added Video-Tests/v2-playWithLeniantCollision.webm
Binary file not shown.
Binary file added images/IllustrateCatchError.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions include/Block.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#ifndef BLOCK_H
#define BLOCK_H

#include <ngl/Vec3.h>
#include <ngl/VAOPrimitives.h>
class Block
{
public:
Block(int _type, bool _isAlive, ngl::Vec3 _position, float _initialSpeed);

//type 0=trash ,1=scoop, 2=bonus scoop
//type determines point val too
int getType() const;
//setting type for initial scoop to change to what you most recently hit
void setType(int _newType);
//getting point value of the scoop to update to cone
int getPointVal()const;
//returns if the block is alive
bool getIsAlive()const;
//sets the alive state of the block
void setIsAlive(bool _state);
//returns the position of the block
ngl::Vec3 getPosition()const;
//sets the position of the block
void setPosition(ngl::Vec3 _newPosition);
//returns the value of the speed
float getSpeed() const;
//sets speed to the new desired speed
void setSpeed(float _newSpeed);
//drawing the block
void draw(const std::string &_shader);
// Update block position based on time, position also bound by playable area x and z
//time in
void update(float _deltaTime);

private:
int m_type;
bool m_isAlive;
int m_pointVal;
ngl::Vec3 m_position;
float m_initialSpeed;
};

#endif // BLOCK_H
55 changes: 55 additions & 0 deletions include/Cone.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#ifndef CONE_H
#define CONE_H

#include <vector>
#include "ngl/Vec3.h"
#include "Block.h"
#include <ngl/AbstractVAO.h>
#include <memory>
#include <string_view>

#include <ngl/Obj.h>
#include <ngl/Transformation.h>

class Cone
{
public:
Cone(int _lives=3,int _points=10, float _speed=0.1f, ngl::Vec3 _position={0.0f,1.0f,0.0f});

ngl::Vec3 getPosition();
void setPosition( ngl::Vec3 _pos);

//player lives, if hits 0 then ends game
int getLives() const;
void setLives(int _lives);

int getPoints() const;
//allows for points of player to be reduced or added based on type of block caught
//if check collision
//getPoints+block.getPointVal
void setPoints(int _points);
//movement
float getSpeed() const;
void setSpeed(int _speed);
void move(float _x,float _y, float _z, float _boundary);

// Collision -w- Blocks checked
void updateScoreAndLives(int _scoreChange, int _livesChange);
//making a distance formula where sqrt((x2-x1)^2+(y2-y1)^2) but in 3D
float distanceBetweenVec(ngl::Vec3 &_point1, ngl::Vec3 _point2);
//checks if the block collides with the cone, if so then it determins based on block type what the geometry of the block
bool checkCollision(ngl::Vec3 _blockPosition, int _blockType, ngl::Vec3 _playerPosition, float _playerYOffset);
//draws out player cone
void draw( const std::string &_shader,float _r,float _g,float _b);

private:
ngl::Vec3 m_pos;
int m_lives;
int m_points;
float m_speed;
ngl::Vec3 m_colour;
ngl::Transformation m_transform;

};

#endif
Loading