18 Replies - 468 Views - Last Post: 10 February 2013 - 03:35 PM
#1
Most Practical way of setting multiple limits in multiple forms.
Posted 09 February 2013 - 03:10 PM
Ive been making the basic structure of my RPG game in Visual Basic 2010, Ive got almost everything i need to start the game itself whit not much effort.
But right now, i want to know what is the most practial way to set map limits in the forms.
I did this in early games by setting the "map" as the form background, then placing transparent pictureboxes boxes over the things i didnt want the player to go walking on (Ex. trees, houses.),then, i would create Rectangles whit equal dimentions as the pictureboxes (I used transparent pictureboxes so i could set the limits visually instead of editing the rectangles blindly)then, i would put that if the rectangle that was equal to the player intersected whit the rectangle that was the wall, for example, it wouldnt walk.
But now i think this method could be simplified, i just need a heads up in the right direction
Thank you all
Replies To: Most Practical way of setting multiple limits in multiple forms.
#2
Re: Most Practical way of setting multiple limits in multiple forms.
Posted 09 February 2013 - 05:01 PM
#3
Re: Most Practical way of setting multiple limits in multiple forms.
Posted 09 February 2013 - 05:25 PM
#4
Re: Most Practical way of setting multiple limits in multiple forms.
Posted 09 February 2013 - 07:35 PM
_HAWK_, on 09 February 2013 - 05:01 PM, said:
Thank you very much, may i say!
What would you say its the best soruce to guide myself trough 'GDI+', as im new to that.
LilGhost, on 09 February 2013 - 05:25 PM, said:
Sir, its my semester project.
Thank you, ill look into that
Oh, i forgot to ad 'HAWK', that i think using rectangles to draw objects its not possible for my project. As all elements on the map are ripped of from a RPG engine, and its easier to just print screen the map i created there and put it as background.
Thanks
#5
Re: Most Practical way of setting multiple limits in multiple forms.
Posted 09 February 2013 - 07:41 PM
#6
Re: Most Practical way of setting multiple limits in multiple forms.
Posted 09 February 2013 - 08:09 PM
#7
Re: Most Practical way of setting multiple limits in multiple forms.
Posted 09 February 2013 - 08:50 PM
One of them said that instead of checking the 'player' object to collide whit 'walls' objetcs,
i should check for walls to collide whit the player object. Is this a better way?
One comment said that it is better to use bouce spheres, what is this?
the other one said that i should create a collision engine to check if anybody is colliding whit anybody, but i have no idea on how to approach this.
#8
Re: Most Practical way of setting multiple limits in multiple forms.
Posted 09 February 2013 - 09:40 PM
#9
Re: Most Practical way of setting multiple limits in multiple forms.
Posted 09 February 2013 - 10:08 PM
Thank you.
I will try to implement the loop thingy..
What do you mean for 'type' of rectangle?
I was now experimenting whit my code.
i created a rectangle and a timer which looks for instersections. If the player intersects whit the wall WHILE going to one direcction, the player will go the opposite direccion the same ammount of steps.
I was trying to make the player just stop moving, which is what i really wanted, and i did, and it works well if the player can only touch the rectangle from one side. This by saying that if the player intersected whit the rectangle while going right, boolean Intersect would be true, and player would not be able to move right.
This does not work on more than two directions because if the boolean intersects = true for both left and right side, player wont be able to move left if it touched the object while moving right.
is there a way to make it work?
Thanks
#10
Re: Most Practical way of setting multiple limits in multiple forms.
Posted 09 February 2013 - 10:18 PM
I think the solution might be to evaluate if they WILL intersect on the next player step.
Like simulating the next player step or something..
am i right?
#11
Re: Most Practical way of setting multiple limits in multiple forms.
Posted 09 February 2013 - 10:32 PM
#12
Re: Most Practical way of setting multiple limits in multiple forms.
Posted 09 February 2013 - 11:10 PM
*Edit i meant test
#13
Re: Most Practical way of setting multiple limits in multiple forms.
Posted 10 February 2013 - 07:52 AM
Player = Object 1
Playertest = Object 2
playertest.location = player.location
Variable Intersects as Boolean
PLayer = new rectangle
Wall = new rectangle
Timer if playertest intersects whit wall, Intersects = True
(In the code of the player walking animation and moving to the right/left whatever.)
Loc = new point (playertest.location.x + 5, playertest.location.y)
playertest.location = loc
if intersecs = false then
loc = new point (player.location.x+, player.location.x)
player.location = loc
playertest.location = player.location
else
(nothing happenns
end if
TO my understanding, this would first test if the playertest intersects whit the wall, before actually moving the player itself. Then, if intersects = false, it moves the player to that position and resets the playertest position to the player position, so it can start the cycle again.
Is my logic wrong in some aspect? thank you
#14
Re: Most Practical way of setting multiple limits in multiple forms.
Posted 10 February 2013 - 02:03 PM
#15
Re: Most Practical way of setting multiple limits in multiple forms.
Posted 10 February 2013 - 02:12 PM
_HAWK_, on 10 February 2013 - 02:03 PM, said:
..I suppose if it were a large map you might divide it into sectors, so that you are not checking every wall, each time? But then you would have to handle the situation where a wall crosses (one or more) sectors.
(Just speculating)
This post has been edited by andrewsw: 10 February 2013 - 02:13 PM
|
|

New Topic/Question
Reply



MultiQuote



|