[help]From codeblocks to Visual studio 2012

Hi,im making a text baesed videogame,i made the first battle and my brother said"textbased games sucks".So i knew about visual stubio and bought the license.I copied my code from codeblocks to visual studio and it failed on codeblocks i used minGW(not sure this is important)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#include<iostream>
#include"STRUCT ENEMY.h"
#include"STRUCT PLAYER.h"
#include<cstdlib>
using namespace std;
int main (){
bool woodSwordC=false,stoneSwordC=false,ironSwordC=false,goldSwordC=false,diamondSwordC=false,leatherArmC=false,ironArmC=false,goldArmC=false,diamondArmC=false;
cout<<"     DEADLY SPLENDER     "<<endl;
cout<<"     Made by DiamondHelm  "<<endl<<endl<<endl;
system("pause");
system("cls");
cout<<"Dr.Alex:Hi,I'm Dr.Alex.I found you sleeping in the"<<"forest.Good,I saved you from those Splenders!!!"<<endl;
system("pause");
system("cls");
cout<<"Johny:Splenders!?What...what is that?"<<endl;
system("pause");
system("cls");
cout<<"Dr.Alex:Evil Creatures of the night!!!"<<endl<<"What's your name???"<<endl;
system("pause");
system("cls");
cout<<"Johny:I don't remember."<<endl;
system("pause");
system("cls");
cout<<"Dr.Alex:You may have amnesia.."<<endl<<"However, I will give you equipment and we cloud start"<<"preparing for the attack"<<endl;
system("pause");
system("cls");
cout<<"Johny:What attack???"<<endl;
system("pause");
system("cls");
cout<<"Dr.Alex:I try to attack Spleders in the Splendy Forest,but"<<endl<<"I never SUCCED because I'm alone,now with you"<<endl<<"WE WILL SUCCED!!!!"<<endl;
system("pause");
system("cls");
struct player Johny;
Johny.life=20;
Johny.attack=2;
Johny.money=15;
cout<<"You start with 20HP , attack=2 and 15GOLD";
cout<<endl<<"Dr.Alex:Sorry,you're a bro, but i don't give anything for free"<<endl;
 long long number,options;
 cout<<"BUY a wooden sword and a leather armour,to continue!!!";
cout<<"Dr.Alex:Wanna Buy Something???Tell me the id and ima give it to ya,if you"<<" Have money of course"<<endl<<"ID's:WooednSword=1;StoneSword=2;IronSword=3;GoldenSword=4;DiamondSword=5"<<endl;
cout<<"LeatherArmour=6;IronArmour=7;GoldArmour=8;DiamondArmour=9"<<endl;
cout<<"Costs:1=5gold;2=10gold;3=15gold;4=20gold;5=25gold"<<endl;
cout<<"6=10gold;7=15gold;8=20gold;9=25gold"<<endl;
cout<<"DMG:1=+5;2=+10;3=+15;4=+20;5=+25"<<endl;
cout<<"ArmourDurability:6=+10HP;7=+15HP;8=+20HP;9=+25HP"<<endl<<"money:"<<Johny.money<<endl<<"If you don't wanna buy something press 10"<<"Number:";
cin>>number;
if(number==1 and woodSwordC==false and Johny.money>=5){
    Johny.money=Johny.money-5;
    Johny.attack=Johny.attack+5;
    woodSwordC=true;
    number=0;
    cout<<"You bought:wooden sword"<<endl;
    cin>>number;
}
if(number==1 and woodSwordC==true or Johny.money<5){
    cout<<endl<<"WARNING:buying two items from the same sort is not allowed or you dont have enough money!!!!"<<endl;
}
if(number==2 and stoneSwordC==false and Johny.money>=10){
    Johny.money=Johny.money-10;
    Johny.attack=Johny.attack+10;
    stoneSwordC=true;
    number=0;
    cout<<"You bought:stone sword"<<endl;
    cin>>number;
}
if(number==2 and stoneSwordC==false or Johny.money<10){
    cout<<endl<<"WARNING:buying two items from the same sort is not allowed or you dont have enough money!!!!"<<endl;
}
if(number==3 and ironSwordC==false and Johny.money>=15){
    Johny.money=Johny.money-15;
    Johny.attack=Johny.attack+15;
    ironSwordC==true;
    number=0;
    cout<<"You bought:iron sword"<<endl;
    cin>>number;
}
if(number==3 and ironSwordC==true or Johny.money<15){
    cout<<endl<<"WARNING:buying two items from the same sort is not allowed or you dont have enough money!!!!"<<endl;
}
if(number==4 and  goldSwordC==false and Johny.money>=20){
    Johny.money=Johny.money-20;
    Johny.attack=Johny.attack+20;
    goldSwordC=true;
    number=0;
    cout<<"You bought:gold sword"<<endl;
    cin>>number;
}
if(number==4 and goldSwordC==true or Johny.money<20){
    cout<<endl<<"WARNING:buying two items from the same sort is not allowed or you dont have enough money!!!!"<<endl;
}
if(number==5 and diamondSwordC==false and Johny.money>=25){
    Johny.money=Johny.money-25;
    Johny.attack=Johny.attack+25;
    diamondSwordC=true;
    number=0;
    cout<<"You bought:diamond sword"<<endl;
    cin>>number;
}
if(number==5 and diamondSwordC==true or Johny.money<25){
        cout<<endl<<"WARNING:buying two items from the same sort is not allowed or you dont have enough money!!!!"<<endl;
}
if(number==6 and leatherArmC==false and Johny.money>=10){
    Johny.money=Johny.money-10;
    Johny.life=Johny.life+10;
    leatherArmC=true;
    number=0;
    cout<<"You bought:leather armour"<<endl;
    cin>>number;
}
if(number==6 and leatherArmC==true or Johny.money<10){
       cout<<endl<<"WARNING:buying two items from the same sort is not allowed or you dont have enough money!!!!"<<endl;
}
if(number==7 and ironArmC==false and Johny.money>=15){
    Johny.money=Johny.money-15;
    Johny.life=Johny.life+15;
    ironArmC=true;
    number=0;
    cout<<"You bought:iron armour"<<endl;
    cin>>number;
}
if(number==7 and ironArmC==true or Johny.money<15){
       cout<<endl<<"WARNING:buying two items from the same sort is not allowed or you dont have enough money!!!!"<<endl;
}
if(number==8 and goldArmC==false and Johny.money>=20){
    Johny.money=Johny.money-20;
    Johny.life=Johny.life+20;
    goldArmC=true;
    number=0;
    cout<<"You bought:gold armour"<<endl;
    cin>>number;
}
if(number==8 and goldArmC==true or Johny.money<20){
       cout<<endl<<"WARNING:buying two items from the same sort is not allowed or you dont have enough money!!!!"<<endl;
}
if(number==9 and diamondArmC==false and Johny.money>=25){
    Johny.money=Johny.money-25;
    Johny.life=Johny.life+25;
    diamondArmC=true;
    number=0;
    cout<<"You bought:diamond armour"<<endl;
    cin>>number;
}
if(number==9 and diamondArmC==true or Johny.money<25)
if(number==10){
    cout<<"Dr.Alex:Maybe next time"<<endl;
}
cout<<"Dr.Alex:AAAAAAAAAAAAAAH!!!!"<<endl<<"SPLENDER!!!";
system("pause");
system("cls");
struct enemy tut;
tut.life=rand()%10+1;
tut.loot=rand()%5+1;
tut.attack=2;
cout<<"A evil Splender apeared!!!"<<endl;
system("pause");
system("cls");
cout<<"Chose what to do:0=attack and every number which is not 0=run away"<<endl;
cin>>options;
if(options==0){
cout<<endl<<"Johny attacked Splendy"<<endl;
tut.life=tut.life-Johny.attack;
cout<<"Splender lost "<<Johny.attack<<"HP"<<endl<<"Splender's health:"<<tut.life<<"HP"<<endl;
}else{
cout<<"You ran away slender tp'd infront of you and eaten you mind of an magical number and write it"<<endl;
cin>>options;
}
if(tut.life<=0){
cout<<"Splender died"<<endl;
Johny.money=Johny.money+tut.loot;
cout<<"You recieved:"<<tut.loot<<" Gold"<<"Total:"<<Johny.money;
cout<<"Dr.Alex:BRAVO,you are good!Thannks for saving me.Let's go to da splendy forest"<<endl;
}
cout<<"Dr.Alex"
system("pause");
system("cls");

system("pause");
}

and if you can tell me how to import graphics inside it would be good XD
Last edited on
what exactly failed? And you have to link a library like sdl or sfml to your compiler to use graphics. You link the headers and dlls in the compiler settings.
(im a newbie, so if i say smth stupid dont laugh)
firstly i have lineked my headers
1
2
3
4
//STRUCT ENEMY.h
struct enemy{
    long long life,attack,loot;
    };

1
2
3
4
//STRUCT PLAYER.h
struct player{
    int life,attack,money,level;
};

secondly, arent dlls for c#
and thirdly from where i get sdl or sfml files
I'm talking about linking the dlls and headers from the library you are going to be using like sdl or sfml. Google them. "sdl" or "sfml" it should also have installation instructions.
> I copied my code from codeblocks to visual studio and it failed

Did you also copy your header files? (enemy.h etc.)


> and if you can tell me how to import graphics inside it would be good XD

Start with this; you won't need any additional libraries.
http://www.winprog.org/tutorial/
What is that
gblit can i ask you for a better explanation
http://lazyfoo.net/SDL_tutorials/lesson01/index.php
Don't worry about it saying SDL you should set up all libraries the same.
Topic archived. No new replies allowed.