Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Select a Unit and stop by Collision

Author
Message
sprcoll
12
Years of Service
User Offline
Joined: 26th Aug 2012
Location:
Posted: 10th Jan 2015 23:58
Hello all together, i would be happy if someone helps me by the following problem.
I want to select a sprite and then i can move the sprite, without a selection i can´t move it. The sprite moving has to stop by collision with a wall, then i can select again.

I use the following code:

if space = 1 and getspritecollision (3(cursor),56(player)) = 1
choice = 1
endif

if choice = 1 and d_arrow = 1
move_yd = 1
player_green_y = player_green_y+1
elseif d_arrow = 0 and move_yd = 1
player_green_y = player_green_y+1
endif

The sprite is on finish, i set choice to 0 that i can select another sprite

if getspritecollision (56(player),100(wall)) = 1
move_yd = 0
choice = 0
endif

What have i to do, that i can select a sprite again when i press the space button? I guess the problem is, that i set choice to 0 by collision, but i don´t know how i can it make better.

I have tried many different things, but i could not find a way.

Thank you for help
mrradd
9
Years of Service
User Offline
Joined: 24th Feb 2015
Location: CA, USA
Posted: 19th Mar 2015 22:06
Is this still an issue that needs to be addressed?

-mrradd-
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 20th Mar 2015 10:40
i guess it stay in collision.
maybe go at collision back to a non collision position (last pos).
also useful ist the print command in main loop or after condition.
print out values or info text.

AGK 108 (B)19 + AppGameKit V2 Alpha .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)

Login to post a reply

Server time is: 2024-11-25 18:37:31
Your offset time is: 2024-11-25 18:37:31