i have an assignment which i have done everything i need for except that i need to make sure that any number entered which isnt an interger is rounded up to the nearest whole interger. I know that i need to use the ceil function. how to use this at all. Here is the part of my program that needs to be rounded up.
Still working with SDL2 and c++ my map collision is messed up since I implemented my Camera.
I do understand that everything has a relative Position on the Screen, depending on the camera.
Problem No. 1: The camera is not moving as fast as the Player, despite having the absolutly same velocity (4/-4)??? How can this be O_o
Problem No. 2: My tile collision is totally messed now. Probably its because of the difference between the Player Position and the camera :/ So if you can solve Problem no. 1, Problem number 2 might work out on its own :)
I've been working on my 2D platformer for a while, and I'm running into a couple of problems. It seems to become laggy even when only about 25 entities need to do collision detection with the 8 walls in the area.
Only one thing to note: the BOOST_FOREACH(const Edge& edge, this->GetCollisonBoxEdges()) { sections actually aren't a loop, all players and enemies are basically a vertical line for purposes of hitting walls, so that's why there is some weird stuff in there (like assuming the edge is oriented a certain way, etc).
I'm still working on my Project and the next Problem has occured: How do I detect collisions on a tilebased map? My tiles are 16x16 and the map is based on the tutorial of [URL] ..... I really like this Approach because I can define for each tile of what type it should be (so a earth tile can be walkable and lead to a secret passage).
The first Number stands for what Kind of tile it should be (e.g. Grass, Earth, Water, Blank,...) and the number after ":" stands for the type of the tile (e.g. solid, walkable, do dmg to the Player,...).
e.g. 0:0 0:0 0:0 0:0 0:0 //No tile and walkable 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 1:1 1:1 1:1 1:1 1:1 //Grass tile and solid 2:1 2:1 2:1 2:1 2:1 //Earth tile and solid
It's working just fine with loading the Images, but i've got no clue about the collision. I've already read a lot of stuff on the Internet but I don't get how to Combine it the structure from above. For example lazyfoo describes the collision with one object like one wall. So how can I check the Player Position with each tile?
For now there's no camera, but I plan to implement one later...
I'm making a 2D Terraria-like (side-scrolling RPG with destroyable blocks) game with SFML 2.1, and I have no clue how to correctly implement collision detection. Meaning that I have been successful at making it work, but it's not clean and definitely not dynamic.
By example, I mean design wise. What parameters should collision functions take? Where should these functions be located? The same 2 questions for collision reaction. Since I have multiple things that need to collide with each other (player with enemy, player with items, enemy with items, enemy with enemy, player with player, etc...), and the world has to be treated differently, things get complicated. There is no block class, just a vertex array, so collision with the world is based purely on coordinates taken from that array in the world class, which, considering it's the world and not something like a player or an enemy, doesn't inherit from the same base class that they do.
I have made a simple 2d shooter (bird eye view) and want implementing the collision detection between the monsters and bullets. The problem is as follows
Each monster has locationX, locationY as coordinates. Each monster has a Rectangle representing its collision box, (if bullet inside rectangle then its a collision). Each bullet has locationX, locationY as coordinates as well.
pretty standard up till now.
each frame I need to check if some bullet collided with some monster.
the brutal force is to keep a list of all the bullets and monsters and to check the possibility of collision between all of them which takes O(#bullets * #monsters).
error C3867: 'WordParsor::Form1::PutUpfrmIO': function call missing argument list; use '&WordParsor::Form1::PutUpfrmIO' to create a pointer to memberc:userskingc++wordparsorwordparsorForm1.h... and the suggestion fix generate another error.
One person suggested the gcroot<> object wrapper... but I do not know how to modify/declair the function or its argument type.
I want to run Unhidden.exe in drive N: and send char to that program. I use function like this
Code: system("N:/Unhidden.exe");
It can open Unhidden.exe but it run in visual studio 2010Projects . I try to use command N: and Unhidden.exe in cmd it can run in drive N: . So I try to use function like this
system("N:"); system("Unhidden.exe");
but it not found Unhidden.exe . How to use 2 command in sytem() function ?
If I declared that code in a header file I'd be able to call it with an int, float, double or whatever. But where does the actual code get instantiated? Is it effectively inlined?
What I'm wondering is if there'd ever be any scenario for putting such code in a DLL - e.g.
I just tried it and was slightly surprised to find it wouldn't compile. It compiles fine when actually building the DLL but when I try to build something else which uses that DLL I get compiler error C2491 (definition of dllimport function not allowed).
I guess that kinda makes sense if template functions are effectively inlined... or is there some other explanation....
I am really unsure how to keep within the boundries and still perform the function I need. My code functions normal when I have both categories 'buy' and 'sell' in the queue which is my main goal and I should be clocked out on this function BUT, If the queue is missing all 'sell' data, it segment faults.
I don't want to change any of the functionality, just get rid of the segment fault error. It appears b < buydat.size() and buydat[b+1] are in conflict. The purpose of the algorithm is capture the record sets in groups of 7 from data coming in from the www as strings. In that group/set, I pattern match for the string 'Buy' and if true, insert record into vector for processing. I also need the price (y = 3)
How do I capture buydat[2] and buydat[3] in groups of 7 without a segment fault?
I have a window I am opening from the parent Dialog by using DoModal:
CMyDlg dml;
dml.DoModal;
When the window opens I want it to run a function on open. Lets just for example say copy files and show a progress bar. Where can I put the function call so that when DoModal is called that function will execute?
having problem passing arguments between main and a function.
I would like to pass three values to a function, have it calculate a 2D matrix and return it back to main. I would like it to accept variable matrix size. Here is my code: