Naming your character

Get help using Construct 2

Post » Wed Feb 26, 2014 2:27 pm

Hey, so I've been working on naming my character at the file select screen,and I've got most of the things working, but I've hit a few snags. I can't figure out how to simulate a backspace, and I also need to be able to limit the length of the name to 6 characters (so that it can't be sticking out of textboxes).
You do not have the required permissions to view the files attached to this post.
B
26
S
6
G
2
Posts: 38
Reputation: 2,427

Post » Thu Feb 27, 2014 2:22 pm

Hmm... not the easiest thing to fix, then? In that case, at least it wasn't just me.
Image
B
26
S
6
G
2
Posts: 38
Reputation: 2,427

Post » Thu Feb 27, 2014 2:34 pm

on backspace pressed

set playername to left(playername,len(playername)-1)

(not tested)
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Thu Feb 27, 2014 2:39 pm

and re length

if len(playername)>6 .. set playername to left(playername,6)

(not tested)

Your capx certainly looks interesting . I can not see in your capx where you are pressing backspace.
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Thu Feb 27, 2014 2:43 pm

Unfortunately I'm stuck in the file selection screen.
First of all you really should think about your project structure.
You have about 100 Events just to select a letter. You could change that by giving the letters instance variables. Or why don't you already just position them in the construct layer? (and use different layers).
To avoid huge events like event Number 192 you may also add another instance variable to see in which row the letters are.

I assume you want to reduce the text string by one letter, when the user hits the button backspace. Try to use RamPackWobbles Function.
Whenever the user hits a letter check this.
Compare two values len(Text.text) > 6 ... error or something else.

@RamPackWobble: He uses a Sprite that's called backspace.
B
14
S
3
G
1
Posts: 255
Reputation: 2,027

Post » Thu Feb 27, 2014 6:47 pm

Okay, thanks guys, I'll test those things out as soon as I get a chance!
Image
B
26
S
6
G
2
Posts: 38
Reputation: 2,427


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests