Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

0.5.5

  • Loading branch information...
commit c20f35af30bea56b397cab99f0fd5f86629b5bb1 1 parent d257f4e
calex22 authored October 10, 2012

Showing 1 changed file with 45 additions and 6 deletions. Show diff stats Hide diff stats

  1. 51  Trash run/game.cpp
51  Trash run/game.cpp
@@ -15,7 +15,7 @@ int characterWay = 1;
15 15
 
16 16
 int mapCurrrent = 2;
17 17
 bool running = 1;
18  
-
  18
+int modeGame = 1;
19 19
 	
20 20
 #include "game.h"
21 21
 #include "player.h"
@@ -51,19 +51,27 @@ bool gameClass::collision(SDL_Rect* rect1,SDL_Rect* rect2)
51 51
       	{
52 52
                 return 0;
53 53
 		}
54  
-		cout << "QUEST!";
55 54
 				drawQuest();
56 55
         return 1;
57 56
 }
58 57
 
59 58
 void gameClass::movePlayer()
60 59
 {
61  
-	   
  60
+if(mode == 1)
  61
+{
62 62
 	    if(b[0])
63 63
 		{
64 64
 			if(collision(&tmp[1],&questImg[0]) || collision(&tmp[1],&interfaceObject))
65 65
 			{
66  
-				tmp[1].y = tmp[1].y + 2;
  66
+				
  67
+				if(collision(&tmp[1],&questImg[0]))
  68
+				{
  69
+					tmp[1].y = tmp[1].y + 10;
  70
+				}
  71
+				else
  72
+				{
  73
+					modeGame = 0;
  74
+				}
67 75
 			}
68 76
 			else
69 77
 			{
@@ -101,7 +109,15 @@ void gameClass::movePlayer()
101 109
 		{
102 110
 			if(collision(&tmp[1],&questImg[0]) || collision(&tmp[1],&interfaceObject))
103 111
 			{
104  
-
  112
+				if(collision(&tmp[1],&questImg[0]))
  113
+				{
  114
+					tmp[1].x = tmp[1].x + 10;
  115
+				}
  116
+				else
  117
+				{
  118
+					modeGame = 0;
  119
+				}
  120
+				
105 121
 			}
106 122
 			else
107 123
 			{
@@ -142,7 +158,15 @@ void gameClass::movePlayer()
142 158
 		{
143 159
 			if(collision(&tmp[1],&questImg[0]) || collision(&tmp[1],&interfaceObject))
144 160
 			{
145  
-				tmp[1].y = tmp[1].y - 2;
  161
+				if(collision(&tmp[1],&questImg[0]))
  162
+				{
  163
+					tmp[1].y = tmp[1].y - 10;
  164
+				}
  165
+				else
  166
+				{
  167
+					modeGame = 0;
  168
+				}
  169
+				
146 170
 			}
147 171
 			else
148 172
 			{
@@ -180,6 +204,15 @@ void gameClass::movePlayer()
180 204
 		{
181 205
 			if(collision(&tmp[1],&questImg[0]) || collision(&tmp[1],&interfaceObject))
182 206
 			{
  207
+				if(collision(&tmp[1],&questImg[0]))
  208
+				{
  209
+					tmp[1].x = tmp[1].x - 10;
  210
+				}
  211
+				else
  212
+				{
  213
+					modeGame = 0;
  214
+				}
  215
+				
183 216
 			}
184 217
 			else
185 218
 			{
@@ -213,7 +246,13 @@ void gameClass::movePlayer()
213 246
 			}
214 247
 			}
215 248
 		}
  249
+		}
  250
+		else
  251
+		{
  252
+		cout << "ehJ";
  253
+		}
216 254
 }
  255
+
217 256
 void gameClass::drawRect()
218 257
 {
219 258
 	SDL_BlitSurface(character, NULL, screen, &tmp[1]);

0 notes on commit c20f35a

Please sign in to comment.
Something went wrong with that request. Please try again.