Hi guys, it's me again. I've been currently working on the code for my game, and I wanted to use the C++ inheritance. You know, to use less resources with specific variable declarations and so. But I can't get my game to work, no matter what I do! The compiler keeps telling me the following errors:
In file included from SHELLmain.cpp:102:0: C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h: In member function 'virtual variant enigma::OBJ_obj_player::myevent_step()': C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:83:10: warning: statement has no effect [-Wunused-value] 1; ^ C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:88:110: error: expected ')' before ';' token allowjump = place_meeting(x, jumpcheck = keyboard_check_pressed(enigma::varaccess_gamekey(int(core))(2) ); ^ C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:117:10: warning: statement has no effect [-Wunused-value] 1; ^ mingw32-make.exe[1]: Leaving directory `D:/ENIGMA/enigma-dev/ENIGMAsystem/SHELL' mingw32-make.exe: *** [Game] Error 2
These are my object codes:
OBJ_GAMECORE
**** Events ****
Create (3 Lines Of Code) : 0 Execute a piece of code (3 Lines) ------ BEGIN ------ global.gamekey[0]=vk_left; global.gamekey[1]=vk_right; global.gamekey[2]=vk_space; ------ END ------
OBJ_PLAYER
**** Events ****
Create (8 Lines Of Code) : 0 Execute a piece of code (8 Lines) ------ BEGIN ------ image_speed=0; core=obj_gamecore; global float vs=0; global float hmulti=6; global float grav=1; global unsigned short int maxfallsp=20; global signed short int jumpsp=-14; global unsigned short int moves=0; ------ END ------
Normal Step (37 Lines Of Code) : 0 Execute a piece of code (37 Lines) ------ BEGIN ------ hs=(keyboard_check(core.gamekey[1])-keyboard_check(core.gamekey[0])); //Left-Right movement in a single line
//Horizontal movement result if hs!=0 { moves=abs(hs)*hmulti; //"moves" is the amount of horizontal pixel movement performed in this frame! while ((moves>0)==true && place_meeting(x+hs,y,obj_block)==false) { //A perfect and good-looking code to avoid block tresspassing x=x+hs; moves--1; } }
//local bool allowjump=place_meeting(x,y+1,obj_block); local bool allowjump=place_meeting(x,y+1,obj_block); local bool jumpcheck=keyboard_check_pressed(core.gamekey[2]); if (allowjump==true) && (jumpcheck==true) { vs=jumpsp; } else if (place_meeting(x,y-1,obj_block)==true && vs<0) || (allowjump==true && (vs>=0)) || (keyboard_check_released(core.gamekey[2])==true && vs<0) { //Vertical block hit; jump cancelation vs=0; } else if (vs+grav)<maxfallsp { //Keep the 20px/frame falling speed limit vs=vs+grav; } else { vs=maxfallsp; }
//Vertical movement result if vs!=0 { moves=abs(vs); //"moves" is the amount of vertical pixel movement performed in this frame! local signed short vdir=sign(vs); while ((moves>0) && !place_meeting(x,y+vdir,obj_block)) { y=y+vdir; moves--1; } } ------ END ------
|