C++ :: Making A Moving Item Controlled By Using WASD
Mar 21, 2013
I'm working on a personal project with a screen that looks like this:
+++++
+++++
++O++
+++++
+++++
And below that it asks where you want to move. I've done the majority of the work, I just have to figure out how to actually move the O. Here's my source code:
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
[Code]....
View 2 Replies
ADVERTISEMENT
Jun 13, 2014
i want to make moving button or moving box clickable as i am making a game in which i move picture boxes and user clicks on it and his scores increases. but i was unable to do so , so i tried the same concept with buttons but no results.
View 7 Replies
View Related
May 17, 2012
I have a strange problem in using C code. I want to move focus from one item to another in a keypress event (like keydown)in loop. But it move directly to the last item
Details: In the code segment, I am generating keypress event explicitly from code and want to move focus for number of items inside loop. Loop is working properly, but output is also generated after completion of loop and focus is directly coming on last item in list not showing intermediate movements. Voice output using espeak is generated correctly in each iteration.
Tryouts: I have tried to call a dilog box which take yes/no event by Btn press,that works fine. That means event generation in code is giving problem, it needs h/w intervention for keypress (As I understood)..
View 10 Replies
View Related
Jan 2, 2014
The program should be print the numbers 0 through 10, along with their values doubled and tripled. The data file contains the necessary variable declarations and output statements.
Example the output:
Single Double Triple
1 2 3
2 4 6
3 6 9
4 8 12
here my code tell me if correct
#include <iostream>
#include <cstdlib>
using namespace std;
int main () {
int x, double, triple;
[Code] .....
View 1 Replies
View Related
Sep 15, 2014
I have two menu items. When item 1 is disabled, I want item 2 to be disabled as well. In the OnUpdate handler of menu item 1, I have tried to use "t_pMenu = pCmdUI->m_pMenu;", "t_pMenu = pCmdUI->m_pSubMenu;" and "t_pMenu = pCmdUI->m_pParentMenu;" but I always get NULL t_pMenu. How can I achieve this purpose?
Code:
void CDummyView::OnUpdateMenuItem1(CCmdUI* pCmdUI)
{
if(m_bShowMenuItem1) {
pCmdUI->Enable(TRUE);
[Code]....
View 14 Replies
View Related
Jun 3, 2013
need to create a program for the following problem
1.Program takes messages as input at a rate “X” msg/sec, and outputs those messages at “Y” mgs/sec in a file.
2.The peak value of X can be 10msg/sec, and Y can be at max 5msg/sec. System should be designed in such a way that it can handle the peak input rate of 10msg/sec for not beyond 5 minutes.
3.Message contains following fields – unit id, timestamp, temperature.
4.Input data to be read from a file. Output data to be written to a file.
5.For testing design 3 types of profiles –
a.Profile 1 for 10 min – low rate, i.e. X = 4 msg/sec on an average throughout the period.
b.Profile 2 for 10 min – Max rate, i.e. X = 10 msg/sec for 2 min; then a sleep of 2 min, then repeat the same pattern till complete period
c.Profile 3 for 10 min - Max rate, i.e. X = 10 msg/sec for 5 min; then no traffic for next 5 min
View 1 Replies
View Related
Sep 27, 2012
Write a count controlled loop than can print "i" char. The user is supposed to input a integer and that integer is how many asterisks there is on the blade, in this case it is 5.
* *
** ** **---------------
*******
** ** **
* ** * -10 Rows high
** -blade always connects on second row of handle
**
**
**
**------------------
These are the steps he told us to do it in.
1) *
**
***
****
*****
2) *
**
***
****
*****
****
***
**
*
3) * *
** **
*** ***
**** ****
**********
4) * *
** **
*** ***
**** ****
**********
**** ****
*** ***
** **
* *
5)* *
** ** **
*******
** ** **
* ** *
**
**
**
**
**
View 4 Replies
View Related
Mar 24, 2013
Is it possible to create a program like Robocode, a game controlled at runtime by an external source file in visual c ++? For example create a checkers game where there would be an external source file, read at runtime, which would play automatically, with artificial intelligence. You can? If yes, how?
View 9 Replies
View Related
Aug 25, 2013
I am creating a pizza program for ordering a pizza and I have removed all the errors except for two. I have tried everything I can think of to fix this problem so it will compile, but to no avail. The only errors left are:
1>------ Rebuild All started: Project: Pizza Order App Midterm, Configuration: Debug Win32 ------
1> stdafx.cpp
1> Pizza Order Midterm.cpp
1> Pizza Order App Midterm.cpp
1>c:usersindia-n-jerrydocumentsvisual studio 2010projectspizza order app midtermpizza order app midtermpizza order app midterm.cpp(57): warning C4390: ';' : empty controlled statement found; is this the intent?
[Code] ....
The entire code is listed below seperated into 1 header and 2 cpp files.
// OrderPizzaApp.cpp : Defines the entry point for the console application.//
#include "stdafx.h"
#include "Pizza_Order.h"
#include <iostream>
#include <string>
using namespace std;
// prototypes
Pizza_Order createPizza_Order();
[Code] .....
View 5 Replies
View Related
Feb 18, 2015
I have a character at a co-ordinate, say (3,4) for example, and I need to get him to (10,15). I would like him to move one block every tick or half a second, so that you can see him moving towards his destination. How to achieve this?
View 3 Replies
View Related
Apr 15, 2014
I'm making this program to mess with people and make them think its a virus.
#define _WIN32_WINNT 0x0500 //For hiding your console
#include <cstdlib>
#include <iostream>
#include <Windows.h>
#include <WinBase.h>
[Code]....
At line 42 and 43 I want to make the cursor move around in a circle over and over again but I'm not sure how.
View 4 Replies
View Related
Nov 30, 2014
I want to make an object in array[][] move
Ex:
array[2][5]
array[0][0] = 'O'
O| | | | |
| | | | |
| | | | |
then
|O| | | |
| | | | |
| | | | |
then
| |O| | |
| | | | |
| | | | |
......
how can i print my array in console then change&print it again, then change&print it again,... So it look like O is moving
???
View 1 Replies
View Related
Apr 28, 2013
I have a board where a character is. I need to ask the user whether they want to move it up, down, left right. They are allowed to enter 3 move per turn. like up, up, left. How do I do this?
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
const int COL = 17;
const int ROW = 17;
[Code] .....
View 3 Replies
View Related
Mar 19, 2014
Basically, my function receives an array. For example:
u8 array = {1, 2, 3, 4, 5}
I don't need the first 2 elements, how can I access the array's 3rd element as head? I plan to throw the received array to another function.
array = array[2];
somefunc(array);
Will somefunc get index 2 as start of the array?
View 1 Replies
View Related
Dec 20, 2013
im trying to get my array to display 5,1,2,3,4 from the original 1,2,3,4,5.
void values::movevalues()
{
cout << "postcondition
";
[Code]....
something in this part is making it go wrong, it displayes the original array fine but when it tries to shift it it goes haywire. EDIT: also how would i add elements onto the array?
View 10 Replies
View Related
Nov 1, 2013
I'm trying to serialize and deserialize objects, some static (that works) one moving (doesn't work). In the code you can see that the following int-variables discribe the moving circle:
object->phaseFarbe=phase1;
object->phaseKoord=phase;
object->rot=a;
[Code].....
View 1 Replies
View Related
Jan 6, 2015
I am making a game and I am attempting to get the zombies to move randomly but for the life of me, I simply don't have the knowledge with srand to do it
#include <iostream>
#include <windows.h>
#include <time.h>
[Code].....
View 13 Replies
View Related
Jan 12, 2015
The question says:
Place an Image on top of a Button. Move both when the Button is pushed.
It's here [URL] exercise no.3
look at this code:
#include <GUI.h>
using namespace Graph_lib;
//------------------------------------------------
class rotation : public Window {
public:
rotation(Point xy, int w, int h, const string& title):
[code]....
The problem is that, it is not possible to define an Image in public/private part of the class rotation. Image needs all arguments to be supplied even when declaring one. (Image is here [URL] And if I define that Image in the body of main() function, so how to provide access for void rotate() to change its position with the position of button simultaneously.
View 8 Replies
View Related
Feb 9, 2013
I am not so experianced with c++ myself, but I need to evaluate if a certain idea might work.
I am working with a system for automation purposes that is running on a realtime OS in parallel to windows. Windows and the RTOS exchange data via shared memory. The application in the RTOS is compiled in C++. Now I would like to be able to influence the some data manipulation tasks in the RTOS application without changing the code of the RTOS application. So a concept like calling a dll.
My idea was to create a class with virtual methods in the RTOS application. The objects that are used should then be created on the Windows side with the same class prototype, but specific implementation of the virtual methods. The objects should then be moved to the shared memory, where they are used by the RTOS application.
Is something like this possible or am I completly on the wrong path?
View 4 Replies
View Related
Feb 16, 2015
Im using SDL2 but I'm encountering an unexpected error. I have implemented the same method to move as in my old Projects, but the Player appears to be stuck...
The Player is stuck for maybe half a second, and then everything works as it should, but every time I Change direction or i start moving the Player is stuck for a short Moment.
#ifndef _PLAYER_HPP_
#define _PLAYER_HPP_
#include <iostream>
#include <string>
#include "SDLGameObject.hpp"
class CPlayer : public CSDLGameObject
[code]....
View 9 Replies
View Related
May 21, 2013
This is for a class project. I am having trouble "pulling out" the last element in my array, shifting all the elements back then inserting that last value in the front. Then also displaying the array after the shift. here's my code.
#include "stdafx.h"
#include<iostream>
using namespace std;
[Code].....
View 3 Replies
View Related
Oct 21, 2014
I'm working on designing a game in C++ that is similar to the "find the ball under the cup" game. I have a Sonic the Hedgehog icon (weird I know, but it was the first thing that came to mind) that will be hidden underneath one of three rectangular blocks.
Here is how I envision this working:
On the main menu I have 3 buttons which represent 3 different difficulty levels
Easy- blocks move 3 times at a slow speed
Medium- blocks move 5 times at a slightly faster speed
Hard- blocks move 10 times at a fast speed
When the user clicks one of these buttons they will be taken to the game screen.
Sonic will be displayed for 3 seconds and the user will then see him be covered with one of the three blocks.
The three blocks will then move in a random pattern along the middle of the screen at the speed and number of times associated with the button that was pressed.
Once the blocks stop moving, the user is to click on the one they think Sonic is underneath.
If they choose correctly, they'll be taken to a "Winning Screen" that displays a congratulatory message and 2 buttons. Play Again- returns the user to the main menu and the game starts over with a new random pattern. Quit- the window closes.
If they choose incorrectly, they'll be taken to a "Losing Screen" that displays a "Try Again" message and 2 buttons that have the same function as the buttons on the winning screen.
I have never worked with any kind of graphics before other than in HTML and Javascript. I have managed to create the main menu, but how to do the actual game portion of the project. I've been trying to take it a step at a time, (for example, I first figured out how to set the background color for the console window, after I got that right I figured out how to add buttons) but the rest of this seems to depend on each other.
Here is what I have so far:
Main menu:
#include "stdafx.h"
#include <iostream>
#include <Windows.h>
using namespace std;
class MainMenu
[Code]....
So I've got the screens pretty much designed now (with the exception of the game screen itself) but how to tie everything together.
In case my description wasn't too clear, here is a game that I found on Google that is pretty much exactly what I'm looking for. [URL]
View 2 Replies
View Related
Apr 6, 2014
I need the number of moves to reset to zero every time because right now when when i enter the next number of disks the moves from before are added to the new set of moves. Here is my output
how many disk are you going to start with? 2
It will take 3 moves
how many disk are you going to start with? 2
It will take 6 moves
how many disk are you going to start with? 2
It will take 9 moves
how many disk are you going to start with? 2
It will take 12 moves
how many disk are you going to start with?
the number of moves for 2 disks should be 3 but as u can see every time i enter 2 disks it just adds to the last number of moves how can i fix this ?
//Purpose: Recursively solve the tower of hanoi problem, moving n disks from A to C.
#include<iostream>
#include<conio.h>
using namespace std;
double number;
void move(int,char,char,char);
//function prototype
[Code] ....
View 2 Replies
View Related
Jul 5, 2014
I know there is strtok() to do the tokenization;but all strtok() examples I have seen only output one token at a time, moving the pointer ahead. Can't the tokens be saved somewhere?
View 6 Replies
View Related
Nov 22, 2012
I have to write tic-tac-toe game in Visual 2010. My only problem is that I don't know how I can move the cursor with arrows in the console in order to fill in chosen positions in 3x3 table:
Code:
_ _ _
_ _ _
_ _ _
I guess that the needed functions are in here: [URL] ....
but I don't know from what to start with...
View 1 Replies
View Related
Oct 29, 2014
lets start with the code:
while(run)
{
if (PeekMessage(&msg, win->win_handle,0,0,PM_REMOVE))
{
[Code]......
I have created a basic window and i discovered that while resizing or moving my windows, the myframe() don't get any calls at all.
Is there anyway possible that myframe gets at least someof the calls while those things are happening
View 1 Replies
View Related