Mini map issues need help

Get help using Construct 2

Post » Fri Oct 05, 2012 4:41 pm

i am making a spaceship game, and i have a minimap working but not to the extent i want to.
problem #1:
I would like to be able to click the mini map and have the ship move to those coordinates(as in position on map relative to layout), but when i click it moves to the spot where i clicked on the screen as if the minimap wasn't there.
Problem #2:
I can get the mini map to show my ship position and 1 of the sprites but i can't get the map to show the all the randomly placed sprites on the map. i was wondering how i can plot the coordinates of all enemy sprites including the one that are spawned to replace the ones that i have destroyed.

I'm sorry i'm new to this and have been looking for the solution to these problems but to no avail if someone could send me a link or explain how i can do this it would be appreciated.
B
10
S
5
G
1
Posts: 6
Reputation: 1,464

Post » Sat Oct 06, 2012 6:22 pm

anyone?
B
10
S
5
G
1
Posts: 6
Reputation: 1,464

Post » Sun Oct 07, 2012 11:08 am

Sorry, I doubt that anyone can help you with that, without seeing your code, ie. the CAPXWeishaupt2012-10-07 11:09:06
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Sun Oct 07, 2012 11:11 am

#1: Make sure in the clicking events, that when you normally click to move ship outside minimap, to check if it is not clicking the minimap.

#2: Depends on how you implement the minimap and plotting. If you are using canvas, just plot a pixel for each live enemy. Be sure to clear between all ticks. Alternatively, if you use sprites, just create a sprite for each enemy that enters the minimap range and move it appropriately.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Mon Oct 08, 2012 3:12 am

ok thanks i have been battleing this problem for a while now i will check out canvas and let you know what i come up with. i'll update if i figure the problem out.
and currently i'm using the pics from a website and i'm not sure if i can get into trouble for using copyrighted pics. if you know let me know lol
thanks to both replies.
B
10
S
5
G
1
Posts: 6
Reputation: 1,464

Post » Mon Oct 08, 2012 6:38 am

#1 is just math.
If the origin of your minimap sprite is at the top left then a mouse click can be converted to layout coordinates with these expressions:
x:
lerp(0,LayoutWidth, unlerp(minimap.X, minimap.X+minimap.Width, Mouse.X))
y:
lerp(0,LayoutHeight, unlerp(minimap.Y, minimap.Y+minimap.Height, Mouse.Y))
B
79
S
24
G
53
Posts: 4,728
Reputation: 40,219

Post » Thu Oct 11, 2012 4:25 pm

ok i'm still having lots of trouble with my sprites being put on the map. my code is as such(i can't post pics):

for each sprite
each tick:          canvas...draw point...
                    Canvas.X +Canvas.Width*(Sprite.X/LayoutWidth)
                    Canvas.Y +Canvas.Height*(Sprite.Y/LayoutHeight)   

if anyone know what i'm doing wrong please let me know.

Rojo: the map issue, i can't get to work because i'm not sure where to put that code i have tried in various places but there is no reaction when i click the map, my ship still moves to the spot i click behind the map. even when i disable my normal movements there is no reaction. i researched the "lerp" and maybe i just don't understand it yet.

Thanks in advance :)
B
10
S
5
G
1
Posts: 6
Reputation: 1,464

Post » Tue Oct 16, 2012 1:51 pm

anyone?
B
10
S
5
G
1
Posts: 6
Reputation: 1,464


Return to How do I....?

Who is online

Users browsing this forum: Eisenhans, michaelverdi and 20 guests