C/C++ :: Spin A Ball Around The Roulette
Mar 12, 2014
As you can see my code runs fine but I have a small problem. I am trying to spin the ball around the roulette but the ball appears 37 times instead of 1. I want only one ball to spin around and not 37.
#include <math.h>
#include <gdfontg.h>
#include <stdio.h>
#include <stdlib.h>
#include <gd.h>
#define USE_GLOBAL_COLORMAP 1
#define USE_LOCAL_COLORMAP 0
[Code] ....
View 7 Replies
Aug 25, 2013
I have created plane as floor and sphere as ball. I used physics equations to it and ball falls under gravity. Now i want to attach visual arrow to this ball which moves with it according to velocity direction. If ball bounces then direction of velocity is changed so does arrow.
View 1 Replies
View Related
Dec 29, 2013
The situation is , I have a ball which should move on a flat horizontal surface which i have created in a display of 800 x 400 . Right now!I am able to make it move left or right in direction using key inputs at a fixed speed.
But I want to make it move horizontally at a constant velocity without using keys. Like in copter game.
It should be able to move automatically , towards the right side.
Increment x position by speed variable does the trick but When I used it with keys I used to limit the movement like.
ball.x += ball.speed;
if(ball.x > 750)
ball.x = 750; // because my screen width is 800.
[URL] .... < this video will show what I really want to do with the ball
If you saw the game video in the link i gave, the ball kept moving with constant velocity. But it never went out of bound. What is keeping it from not getting out of display screen. Instead! its moving continuously... but stays almost at the center of screen. How?
View 7 Replies
View Related
Apr 13, 2014
I have created a game.It is working fine in codeblocks, but when I am trying to run it outside codeblocks, it opens and closes immediately. I have pasted all the necessary files and dlls in root folder and debug folder. Here is the code:-
#include <iostream>
#include <SDL/SDL_mixer.h>
#include <SDL/SDL.h>
#include <SDL/SDL_ttf.h>
#include <sstream>
const int WINDOWS_Height = 480;
const int WINDOWS_Width = 640;
[Code] .....
View 2 Replies
View Related
Feb 9, 2013
I'm trying to make a selection process using roulette wheel selection. To do this I created two matrix, one random probabilities and one increasing probabilities. The idea is to choose a number according to the random probabilities. Here is the code I've written.
#include <iostream>
#include <conio.h>
#include <cstdlib>
using namespace std;
int main (){
float select [5], prob [10], mat [5];
int c, r, z;
cout.precision (2);
cout << "Random Number:" << endl;
[Code]...
The result I got is as follows:
Random Number:
0.0013 0.56 0.19 0.81 0.59
Increasing Probabilities:
0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Selected Column:
0
5
6
8
9
The evaluation doesnt seem to start from c=0 again. The selected column should be 0, 5, 1, 8, 5.
View 6 Replies
View Related